fix: avoid instanceof Object
check in isErrorLike
(#8527)
This commit is contained in:
parent
f0c17378a0
commit
6cd5cd0439
@ -407,7 +407,9 @@ interface ErrorLike extends Error {
|
||||
}
|
||||
|
||||
export function isErrorLike(obj: unknown): obj is ErrorLike {
|
||||
return obj instanceof Object && 'name' in obj && 'message' in obj;
|
||||
return (
|
||||
typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj
|
||||
);
|
||||
}
|
||||
|
||||
export function isErrnoException(obj: unknown): obj is NodeJS.ErrnoException {
|
||||
|
Loading…
Reference in New Issue
Block a user