Skip to content

Commit 6e53f28

Browse files
Convert isIOError to use unknown
1 parent 3b366a6 commit 6e53f28

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,14 @@ export interface IOError {
124124
readonly code: string;
125125
}
126126

127-
export function isIOError(e: any): e is IOError {
128-
return e.code !== undefined && typeof e.code === "string";
127+
export function isIOError(e: unknown): e is IOError {
128+
return (
129+
e !== undefined &&
130+
e !== null &&
131+
typeof e === "object" &&
132+
"code" in e &&
133+
typeof e.code === "string"
134+
);
129135
}
130136

131137
// This function is a wrapper around `os.tmpdir()` to make it easier to mock in tests.

0 commit comments

Comments
 (0)