You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in need of creating a separate type of a mutations result but I fail to do so. I feel like I've typed it all correctly but some how TS is still confused.
// type of function that mutatestypeMyMutation=ReturnType<typeofuseMyMutation>[0];// type of what input goes into the above function typeexporttypeMutationInput=Parameters<MyMutation>[0];// type of function that takes the above input and returns what the mutation function returnsexporttypeOnMutateFunction=(input: MutationInput[])=>ReturnType<MyMutation>;// inside my react componentconst[mutate]=useMyMutation();// the typescript error highlights the input parameter with the error belowconstonMutate:OnMutateFunction=(input)=>{returnmutate(input);};
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm in need of creating a separate type of a mutations result but I fail to do so. I feel like I've typed it all correctly but some how TS is still confused.
Beta Was this translation helpful? Give feedback.
All reactions