Route.useSearch() not inferring type from validateSearch
Was trying out examples from this doc
https://tanstack.com/router/v1/docs/framework/react/guide/search-params#validating-and-typing-search-params
My expectation is useSearch would be typed according to the validated schema. However, the
search type is {}Search Params | TanStack Router React Docs
Similar to how TanStack Query made handling server-state in your React and Solid applications a breeze, TanStack Router aims to unlock the power of URL search params in your applications. 🧠 If you ar...
7 Replies
modern-teal•2mo ago
the
zodValidator from the zod-adapter package is no longer necessary, can you try to pass the productSearchSchema directly?
The docs should be updated I guess ...extended-salmonOP•2mo ago
Same result 🙁
modern-teal•2mo ago
Then I can not reproduce the bug. Can you try to update your package versions? Also try deleting the
routeTree.gen.ts , dont worry it will be regenerated when you run the project again
modern-teal•2mo ago

extended-salmonOP•2mo ago
Regenerating the routeTree seems to fix it. Thanks!
modern-teal•2mo ago
Dang, I thought It would not be the sollution. Were you running the project? routeTree.gen.ts is updated automatically when the web server is running in dev mode
extended-salmonOP•2mo ago
Hmm. Yeah maybe it wasn't running at the time 🥲