We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3b366a6 commit 6e53f28Copy full SHA for 6e53f28
extensions/ql-vscode/src/common/files.ts
@@ -124,8 +124,14 @@ export interface IOError {
124
readonly code: string;
125
}
126
127
-export function isIOError(e: any): e is IOError {
128
- return e.code !== undefined && typeof e.code === "string";
+export function isIOError(e: unknown): e is IOError {
+ return (
129
+ e !== undefined &&
130
+ e !== null &&
131
+ typeof e === "object" &&
132
+ "code" in e &&
133
+ typeof e.code === "string"
134
+ );
135
136
137
// This function is a wrapper around `os.tmpdir()` to make it easier to mock in tests.
0 commit comments