Value returned from `generateSitemaps` is received as a string instead of number
Link to the code that reproduces this issue
https://github.com/therungg/next-sitemap-generation-typing-bug
To Reproduce
- Create a sitemap as per the docs https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps#example
awaitthe id in the sitemap function- The id is actually a string, not a number
Current vs. Expected behavior
The id received in the sitemap function is actually a string, not a number as the type indicates. I expect it to be a number.
This means that, for example, doing a switch case over the id does not work, because it never matches the number in the switch case. See reproduction repo for minimal repro
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025
Available memory (MB): 8937
Available CPU cores: 16
Binaries:
Node: 22.13.1
npm: 10.9.2
Yarn: N/A
pnpm: 10.0.0
Relevant Packages:
next: 16.1.0-canary.16 // Latest available version is detected (16.1.0-canary.16).
eslint-config-next: N/A
react: 19.2.1
react-dom: 19.2.1
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
TypeScript
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
No response
I can take a look at this.
The id value passed to generateSitemaps() is coming through as a string, but the TypeScript type declares it as a number. The runtime behavior and type definitions are inconsistent.
I’ll update the type in the sitemap types to match the actual value.
We fixed the docs. Promise
We don't have yet prop type helpers for these, otherwise these would've catch this. Thanks for the report and time to create a repository.