TanStackT
TanStack2y ago
5 replies
popular-magenta

error Type

So I am converting v4 to v5 and originally I have a code like this
onError: (error: any) => {
    if (error.response?.status !== 401) {
      console.error('<Layout> getting generic input data', error);
     }
 },

But now I am extracting const {error} from useQuery... and it has Error | null as type. Then it throws some typescript check that response is not the type.... how do I fix it properly? Thanks!
Was this page helpful?