TanStackT
TanStack5mo ago
1 reply
standard-azure

Get the type of the search from a specific route ?

Hi,

Is there a way to infer the search type from a specific route ?

To have like :

export const Route = createFileRoute("/lol/live")({
  component: RouteComponent,
  validateSearch: (raw) v.parse(v.object({ /* some schema */}), raw)
});
type RouteSearch = /* some schema type */


I know I could do this extract the schema, put in in another file, import at in the route file and elsewhere where I need it, but I like my schema to be declared directly in the route file. (Can't export it because of vite single export per file rule).
Was this page helpful?