ggascoigne
Types question
I'm slowly migrating an old graphql based project over to trpc v11, using @trpc/tanstack-react-query, and rather liking how it all works, but I'm having some difficulties typing some of the code when I try and wrap some of the queries.
I have simple code like this:
And it works great, but since I have a ton of more complicated apis to migrate, where the variables and the query params change somewhat, I'd like to extract the types for the interface of trpc.<endpoint>.queryOptions. I know how to do this using Parameters<> if trpc were global, but it's not in this pattern, and while I can see that the interface is defined as TRPCQueryOptions<TDef extends ResolverDef>, I basically want to know how I get the type for ResolverDef for my specific endpoint.
6 replies