How to type onError for useMutation?

9 Replies
Aaron
AaronOP3y ago
I tried TRPCClientErrorLike<AppRouter> and there's no type error, but the type is wrong.
cje
cje3y ago
you dont need to type it its all inferred
Aaron
AaronOP3y ago
how to inferred it
cje
cje3y ago
dont write a type hover over the stuff, you will see its typed already
Aaron
AaronOP3y ago
I want to write the onError function outside of the useMutation options, so I want to know how to type or inferred it
Aaron
AaronOP3y ago
here is the type if I hover it:
Aaron
AaronOP3y ago
nvm TRPCClientErrorLike<AppRouter> is correct
Aaron
AaronOP3y ago
Aaron
AaronOP3y ago
the message is string

Did you find this page helpful?