How to extract mutation type
Is it possible to extract mutation type?
I would like to pass a mutation trigger to the parent component but I dont know how I could extract the mutation type so typescript is happy
Solution:Jump to solution
Thanks guys. Altough I cant seem to get it working with InferReactQueryOptions I managed to take te routerinputs and seems working like that
```ts
export type MutateTrigger = (
payload: RouterInputs['batch']['triggerDownload'],...
8 Replies
Inferring Types | tRPC
In addition to the type inference made available by @trpc/server (see here) this integration also provides some inference helpers for usage purely in React.
Oh yeah I misread last night, Katt is correct this is just inferring inputs and using them
Solution
Thanks guys. Altough I cant seem to get it working with InferReactQueryOptions I managed to take te routerinputs and seems working like that
Don’t you want inferRouterInputs as well??
RouterInputs are these.
What’s the problem exactly? This looks fine
I thought I had a problem with payload: RouterInputs['batch']['triggerDownload'],
but after restarting TS its working. So all good now 🙂