tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
553 stars 20 forks source link

Wrong type of the optional catch-all route #183

Closed isstuev closed 2 months ago

isstuev commented 3 months ago

https://github.com/tatethurston/nextjs-routes/blob/main/packages/nextjs-routes/src/__snapshots__/core.test.ts.snap#L1484

should it be dynamic with type { "segments": string[] } instead of static?

tatethurston commented 3 months ago

Yes you’re right that it shouldn’t be static but rather:

DynamicRoute<"/api/[...segments]", { "segments"?: string[] | undefined }>

Happy to accept a PR if you’re up for it.

https://nextjs.org/docs/pages/building-your-application/routing/dynamic-routes#optional-catch-all-segments