zod schema for redirect
Does Tanstack Router generate a schema for zod to validate the routes? If not, could it? My thought is to use for a redirect parameter
6 Replies
fascinating-indigoOP•6mo ago
If anyone is interested, I solved this by:
and
You'll notice I didn't use the tying of
router.routesByPath
becaue there's a small bug in the types, where it doesn't match the runtime behavioursunny-green•6mo ago
which bug?
fascinating-indigoOP•6mo ago
@Manuel Schiller - https://github.com/TanStack/router/issues/3780#issuecomment-2726814524
GitHub
Generated type FileRoutesByFullPath doesn't match runtime type · Is...
Which project does this relate to? Router Describe the bug Problem router.routesByPath is defined as RoutesByPath<TRouteTree> which includes trailing '/' for index routes. However thi...
sunny-green•6mo ago
fyi we have a trailingSlash prop on createRouter, so you could make the types work if you set it to
always
just as a workaround for the time beingfascinating-indigoOP•6mo ago
I don't mind, as I'm aware. Seems like a fairly easy fix
sunny-green•6mo ago
not really as the code generation and createRouter are not coupled