You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a global type, something like RoutesDefinition that contains static and dynamic route types except not requiring a generic parameter passed to it, e.g.
type RoutesDefinition = `/products/${string}` | `/products/${string}/info` | `/products/${string}/variants` | `/products/${string}/variant/${string}`
Non-Goals
Background
Current Route<T> requires providing the route key to it as a generic parameter. This makes it difficult to do static lists of typesafe routes, such as
A workaround would be to pass each navigation here through some helper function that properly infers and type-checks the appropriate constant route string, but it's an ugly workaround compared to just having a slightly less type-safe but much more usable route type
Proposal
With a separate type in addition to the one with the generic parameter
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Provide a global type, something like
RoutesDefinition
that contains static and dynamic route types except not requiring a generic parameter passed to it, e.g.Non-Goals
Background
Current
Route<T>
requires providing the route key to it as a generic parameter. This makes it difficult to do static lists of typesafe routes, such asA workaround would be to pass each navigation here through some helper function that properly infers and type-checks the appropriate constant route string, but it's an ugly workaround compared to just having a slightly less type-safe but much more usable route type
Proposal
With a separate type in addition to the one with the generic parameter
Beta Was this translation helpful? Give feedback.
All reactions