diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index bac4071d5915f..c40cdb499c5c5 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -840,6 +840,43 @@ If you want to keep the old ID generation for backward compatibility reasons, yo Learn more about [Heading IDs](/en/guides/markdown-content/#heading-ids). +### Changed: `getStaticPaths()` cannot return `params` of type number + + + +In Astro 5.x, `getStaticPaths()` could return `params` of type number, which would always be stringified by Astro. However, that could be confusing because it conflicted with `Astro.params` types. + +Astro 6.0 removes this behavior: `getStaticPaths()` must now return string or undefined `params` values. + +#### What should I do? + +Review your dynamic routes using `getStaticPaths()` and convert any number params to strings: + +```astro title="src/pages/post/[id]/[label].astro" del={6,13} ins={7,14} +--- +export function getStaticPaths() { + return [ + { + params: { + id: 1, + id: "1", + label: "foo", + } + }, + { + params: { + id: 2, + id: "2", + label: "bar", + } + }, + ] +} +--- +``` + +Learn more about [dynamic SSG routes with `getStaticPaths()`](/en/guides/routing/#static-ssg-mode). + ## Community Resources Know a good resource for Astro v5.0? [Edit this page](https://github.com/withastro/docs/edit/main/src/content/docs/en/guides/upgrade-to/v6.mdx) and add a link below!