Skip to content

Commit 3b366a6

Browse files
Convert isErrorLike to use unknown
1 parent c906e76 commit 3b366a6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

extensions/ql-vscode/src/common/errors.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ export interface ErrorLike {
8484
stack?: string;
8585
}
8686

87-
function isErrorLike(error: any): error is ErrorLike {
88-
if (
87+
function isErrorLike(error: unknown): error is ErrorLike {
88+
return (
89+
error !== undefined &&
90+
error !== null &&
91+
typeof error === "object" &&
92+
"message" in error &&
8993
typeof error.message === "string" &&
90-
(error.stack === undefined || typeof error.stack === "string")
91-
) {
92-
return true;
93-
}
94-
return false;
94+
(!("stack" in error) || typeof error.stack === "string")
95+
);
9596
}

0 commit comments

Comments
 (0)