- 
                Notifications
    
You must be signed in to change notification settings  - Fork 29.7k
 
Description
What is the documentation issue?
There is incorrect type information in the generateSitemaps example.
The id parameter in the example is typed as a synchronous number, but in Next.js 15+ it should be accessed asynchronously as Promise<{ id: number }> (same as other dynamic route parameters such as generateMetadata or generateStaticParams).
Is there any context that might help us understand?
In Next.js 15, route parameters in App Router functions like generateMetadata, generateStaticParams, and sitemap are wrapped in a Promise.
Therefore, the generateSitemaps example should show asynchronous destructuring, e.g.:
export default async function sitemap({
  id
}: {
  id: Promise<number>
}): Promise<MetadataRoute.Sitemap>{
  const index = await id;
  // ...
}Currently, the docs use:
export default async function sitemap({ id }: { id: number })which causes a runtime or type error if followed exactly.
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps
insd47 and Debblinsd47
Metadata
Metadata
Assignees
Labels
No labels