Skip to content

Astro.params has a wrong type #14057

@ideaexplorer233

Description

@ideaexplorer233

Astro Info

Astro                    v5.11.0
Node                     v24.3.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/svelte

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Astro.params has a wrong type. For example:

export function getStaticPaths() {
  return [
    { params: { id: '1' } },
  ];
}

const { id } = Astro.params;

The IDE / TypeScript says id is a Number, but it’s actually a string.

What's the expected result?

TypeScript should infer the correct type. In this case, id should either be typed as a string or Astro.params.id should behave correctly and actually be a Number.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-uqia3qvx?file=src%2Fpages%2F%5Bid%5D.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)feat: typescriptRelated to TypeScript (scope)requires breaking changeFixing this bug or adding this feature would require breaking changes. For PRs, use "semver: major"

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions