useSearch and conetext are not typed it search types as any and context to {}
My main.tsx
and index.tsx
order and sortBy types as any
context typed as {}
What I'm doing wrong ?
NOTE: this is a react vite project and I manually added tanstack-router and tanstack-query
6 Replies
quickest-silverOP•11mo ago
GitHub
GitHub - inam95/tanstack-playground
Contribute to inam95/tanstack-playground development by creating an account on GitHub.
other-emerald•11mo ago
a few things
latest zod does not not need the
zodSearchValidator anymore.
also, please use @tanstack/zod-adapter instead
quickest-silverOP•11mo ago
Okay but is that the case why i don't get the type safey for search and context ?
wise-white•11mo ago
You also need to use
createRootRouteWithContext in __root.tsx
https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunctionquickest-silverOP•11mo ago
got it thanks
grumpy-cyan•11mo ago
Thanks, this was very helpful