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
genetic-orangeOP•9mo 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 behaviourmultiple-amethyst•9mo ago
which bug?
genetic-orangeOP•9mo 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...
multiple-amethyst•9mo 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 beinggenetic-orangeOP•9mo ago
I don't mind, as I'm aware. Seems like a fairly easy fix
multiple-amethyst•9mo ago
not really as the code generation and createRouter are not coupled