Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS > Using glob imports: pagesGlobToRssItems return is not assignable to rss items #11287

Closed
JoshuaKGoldberg opened this issue Jan 23, 2024 · 1 comment · Fixed by #11299
Closed
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: rss Related to the `@astrojs/rss` package (scope)

Comments

@JoshuaKGoldberg
Copy link
Contributor

📚 Subject area/topic

RSS

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/guides/rss/#using-glob-imports

📋 Description of content that is out-of-date or incorrect

I'm trying to do exactly what he src/pages/rss.xml.js example proposes for items: await pageGlobToRssItems(...). But I'm getting a TypeScript error on the items. Its tl;dr is that some properties are option in the returned items schema from pagesGlobToRssItems, but required in the schema for the items parameter property in rss:

  • link
  • pubDate
  • title
Type '{ title?: string | undefined; description?: string | undefined; pubDate?: Date | undefined; customData?: string | undefined; categories?: string[] | undefined; author?: string | undefined; ... 4 more ...; content?: string | undefined; }[]' is not assignable to type 'Record<string, (...args: unknown[]) => Promise<any>> | RSSFeedItem[]'.
  Type '{ title?: string | undefined; description?: string | undefined; pubDate?: Date | undefined; customData?: string | undefined; categories?: string[] | undefined; author?: string | undefined; ... 4 more ...; content?: string | undefined; }[]' is not assignable to type 'RSSFeedItem[]'.
    Type '{ title?: string | undefined; description?: string | undefined; pubDate?: Date | undefined; customData?: string | undefined; categories?: string[] | undefined; author?: string | undefined; ... 4 more ...; content?: string | undefined; }' is not assignable to type 'RSSFeedItem'.
      Property 'link' is optional in type '{ title?: string | undefined; description?: string | undefined; pubDate?: Date | undefined; customData?: string | undefined; categories?: string[] | undefined; author?: string | undefined; ... 4 more ...; content?: string | undefined; }' but required in type 'RSSFeedItem'.ts(2322)

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

https://stackblitz.com/edit/github-wcs5ut?file=package.json,src%2Fpages%2Frss.xml.ts

@sarah11918
Copy link
Member

Hey @JoshuaKGoldberg ! Sorry, we're just catching up on some ooooold Issues now. 😅

I'm able to reproduce what you're seeing, but I'm not sure whether this is a documentation error (i.e. instructions need changing), or something for our RSS package to address (not produce this error in the first place), which I suspect might be the case? Required properties should probably agree with each other!

So, I'll transfer this to the main astro repo for them to take a look at, and if it turns out that we need to document it better, they'll send it back to us! 😄

@sarah11918 sarah11918 transferred this issue from withastro/docs Jun 19, 2024
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jun 19, 2024
@ematipico ematipico added - P3: minor bug An edge case that only affects very specific usage (priority) pkg: rss Related to the `@astrojs/rss` package (scope) and removed needs triage Issue needs to be triaged labels Jun 20, 2024
@ematipico ematipico self-assigned this Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: rss Related to the `@astrojs/rss` package (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants