fix: expect ofetch missing error response type

This commit is contained in:
wobsoriano
2023-08-23 14:12:29 -07:00
parent 092e3495fd
commit 8f9e398ae2
2 changed files with 196 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ import { type FetchEsque } from '@trpc/client/dist/internals/types'
function customFetch(input: RequestInfo | URL, init?: RequestInit & { method: 'GET' }) {
return globalThis.$fetch.raw(input.toString(), init)
.catch((e) => {
// @ts-expect-error: ofetch response missing type
if (e instanceof FetchError && e.response) { return e.response }
throw e
})