diff --git a/src/api/utils/index.ts b/src/api/utils/index.ts index 162040c8..4d60a21e 100644 --- a/src/api/utils/index.ts +++ b/src/api/utils/index.ts @@ -8,7 +8,7 @@ import { } from '../types/errors'; const isProblemDetails = (e: unknown): e is ProblemDetailsError => - !!e && typeof e === 'object' && Object.keys(e).every((key) => ['type', 'detail', 'title', 'status'].includes(key)); + !!e && typeof e === 'object' && ['type', 'detail', 'title', 'status'].every((prop) => prop in e); export const parseApiError = (e: unknown): ProblemDetailsError | undefined => (isProblemDetails(e) ? e : undefined);