Generated enum type for routeId
#6167
Labels
feature / enhancement
New feature or request
p2-nice-to-have
SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
types / typescript
Milestone
Describe the problem
$page.routeId
is just a string currently, which means you can have typos that won't match the ID of any route. It would be nice if this were typed, so that typos will be caught as type errors, and so that any renamed pages or moved routes will also result in type errors if their corresponding$page.routeId
s aren't also updated.Describe the proposed solution
We know the route manifest at build time. We should be able to construct a
'foo' | 'bar' | 'baz'
type that therouteId
would adhere to. The question would be where this generated type ought to live and how it ought to be accessed by the app code. Ideally, people could just keep using the ambient$app/stores
types, and these would pull in the appropriate enum from.svelte-kit
.Alternatives considered
No response
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: