-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
feature / enhancementNew feature or requestNew feature or requestp2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.types / typescript
Milestone
Description
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 the routeId
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
Rich-Harris, sandstromdev, ivanhofer, mquandalle, techniq and 1 more
Metadata
Metadata
Assignees
Labels
feature / enhancementNew feature or requestNew feature or requestp2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.types / typescript