docs
docs copied to clipboard
RSS > Using glob imports: pagesGlobToRssItems return is not assignable to rss items
📚 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:
linkpubDatetitle
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