Dominik
Infering query/mutation callback opts parameter
Hey 🙂
Thanks for your hard work on this awesome library.
I want to create tRPC router, but i want to pass query (or mutation) callback from other part of the app. I am working with monorepo, and trpc router definition will be stored as a package shared by server (which will provide certain controllers implenetation) and frontend (which will infer type for queries & mutations). Unfortunately I don't know how to properly infer query / mutation parameter type:
Example:
I was playing around with it by myself, but I can't make it work. This was my attempt:
I assume it might be hard to infer due to
fooZodSchema
being passed as input
(runtime evaluation), but I am sure some TypeScript wizards here will help:)1 replies