What is the type of error in react-query MutationCache onError function in Typescript. and how to override the type so that I can take the fullMessage from data, and use it
const queryClient = new QueryClient({
mutationCache: new MutationCache({
onError: (error) => {
const serverError = error as IServerError;
toastError(serverError?.response?.data?.fullMessage);
},
}),
});
I don't want to use the
const serverError = error as IServerError;
as it feels hacky.
I can see using webstorm that there are generics I can pass to it, but I don't understand how can I pass those generics to it.