diff --git a/src/UnauthorizedError.ts b/src/UnauthorizedError.ts index 2707ae5..aa57954 100644 --- a/src/UnauthorizedError.ts +++ b/src/UnauthorizedError.ts @@ -19,7 +19,12 @@ export const isUnauthorizedError = ( error: unknown ): error is UnauthorizedError => { return ( - error instanceof UnauthorizedError && + typeof error === 'object' && + error != null && + 'data' in error && + typeof error.data === 'object' && + error.data != null && + 'type' in error.data && error.data.type === 'UnauthorizedError' ) }