Skip to content

Value returned from generateSitemaps is received as a string instead of number #86959

@therungg

Description

@therungg

Link to the code that reproduces this issue

https://github.com/therungg/next-sitemap-generation-typing-bug

To Reproduce

  1. Create a sitemap as per the docs https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps#example
  2. await the id in the sitemap function
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypeScriptRelated to types with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions