Typed wrappers for procedures
I have a TRPC client with working queries and mutations. I wanted to create wrapper functions for all the procedure so that instead of
It works in run time, and even shows correct types in VSCode, but when I generate a .d.ts, it says these functions have type
trpc.someQuery.query(...) I can use someQuery(...), and instead of trpc.someMutation.mutate(...), someMutation(...). I'm having trouble with getting the wrapped functions to have correct parameter and return types. Currently I have:It works in run time, and even shows correct types in VSCode, but when I generate a .d.ts, it says these functions have type
(input?: unknown, options?: ProcedureOptions | undefined) => Promise<unknown>. How can I fix this issue, and is there a more elegant way to create such wrapper functions? I would prefer to use something like export const someQuery = wrap('someQuery').