We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c906e76 commit 3b366a6Copy full SHA for 3b366a6
extensions/ql-vscode/src/common/errors.ts
@@ -84,12 +84,13 @@ export interface ErrorLike {
84
stack?: string;
85
}
86
87
-function isErrorLike(error: any): error is ErrorLike {
88
- if (
+function isErrorLike(error: unknown): error is ErrorLike {
+ return (
89
+ error !== undefined &&
90
+ error !== null &&
91
+ typeof error === "object" &&
92
+ "message" in error &&
93
typeof error.message === "string" &&
- (error.stack === undefined || typeof error.stack === "string")
- ) {
- return true;
- }
94
- return false;
+ (!("stack" in error) || typeof error.stack === "string")
95
+ );
96
0 commit comments