How to type onError for useMutation?

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