What would be a good practice for writing types for components that get passed a trpc query?
lets say a query looks like this:
i call it from root component, and i get my typesafe query, all is cool, but now i need to pass the query somewhere else. for that, i need to specify the type
3 Replies
one way i go around this, is type inference,
`
but that kinda sucks
You can take the type from routeroutouts type
Inferring Types | tRPC
It is often useful to wrap functionality of your @trpc/client or @trpc/react-query api within other functions. For this purpose, it's necessary to be able to infer input types and output types generated by your @trpc/server router.