2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-06 19:30:11 +02:00

fix: safer (and correct) isUnauthorizedError

This commit is contained in:
Divlo 2023-04-02 23:32:28 +02:00
parent 71e0d82655
commit 41a0f1839f
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9

View File

@ -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'
)
}