T
tRPC

How to infer the output of a mutation? The current methods appear to be depreciated.

How to infer the output of a mutation? The current methods appear to be depreciated.

Ttaylor.presto10/21/2022
I am attempting to export the bellow utility function to use client side to infer an output type that I can pass to a couple components that are consuming the data. It appears the the ''mutations' is depreciated here when trying to access it off the '_dep'? I did some digging the code base and that seems to be the case. Does anyone have advice on how to infer this type so I can pass it where it is needed?
export type inferMutationOutput<
TRouteKey extends keyof AppRouter['_def']['mutations']
> = inferProcedureOutput<AppRouter['_def']['mutations'][TRouteKey]>
export type inferMutationOutput<
TRouteKey extends keyof AppRouter['_def']['mutations']
> = inferProcedureOutput<AppRouter['_def']['mutations'][TRouteKey]>
DDani;10/21/2022
Are you on trpc v10? If so, look at the new ways of inferring types: https://trpc.io/docs/v10/infer-types
Ttaylor.presto10/21/2022
Ahhhh I think that was it. I think someone updated the package on me and I missed it 🤦‍♂️ Thanks @Dani;

Looking for more? Join the community!

T
tRPC

How to infer the output of a mutation? The current methods appear to be depreciated.

Join Server