types not working if input provided
Hey guys, just getting into tRPC: If i add a input to a query, in the client, the types are not working anymore. thats normal? is there any way around this?
9 Replies
I am using React Query and the data is just unknown if I add a input to the server query
Can you share how you've defined the procedure input and how you are calling the query on the client?
you mean this?:
here's how I call the query:
just getting into tRPC, so hope thats a good way to do it at all
Hm yeah that looks correct. Are your trpc client/server versions mismatched maybe?
client:
server:
so yeah, everythings matching. whats weird is that it only cant infer types if I add the .input on the query - without, it works. also on mutations the input is just working fine
That's weird. In my project I have the exact same setup: Hono, trpc, etc and I don't have this issue.
Could it be that the keys
path
and/or context
of your input object cause problems? Or anything else in the input object? That's my only guess
... that is, if only that particular query is affected and other queries workdon't think so, I mean its the same with just a simple zod string.
its not particular only this one, every query where I try to use a input has the problem. mutations are working, and queries without an input aswell
What's your Typescript and tanstack/react-query versions?
typescript 5.8.3, react query 5.83.0 atm