Can we get type safety for onEnter/onLeave #1219
-
The argument of onEnter/onLeave is of type AnyRouteMatch which forces me to use type casting like: onEnter: (match) => {
const loaderData = (match as RouteMatch<RegisteredRouter["routeTree"], typeof myRoute.types.id>).loaderData;
} Is it safe to do type casting here? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I'd also like to know about this. |
Beta Was this translation helpful? Give feedback.
-
I implemented this in https://github.com/TanStack/router/releases/tag/v1.29.0 |
Beta Was this translation helpful? Give feedback.
-
Amazing! |
Beta Was this translation helpful? Give feedback.
I implemented this in https://github.com/TanStack/router/releases/tag/v1.29.0