onError callback type
I want to have a callback onError passed from parent component to the child which has mutation call. onError should be passed directly to the mutation options but also accept plan Error type and undefined. But I struggle how to type it correctly.
3 Replies
Probably you can type it like:
It doesnt satisfiy the constrain
TS2344: Type unknown does not satisfy the constraint ErrorInferrable
This seems to work but not sure if this is any better approach.
@Mugetsu, did you find a solution?
I'm doing something alike, my problem is the parameter type and I sorted it out like so:
error: (error: TRPCError) => {
return <>{error.message}</>;
},
So far Im not getting any error/warning.