File tree Expand file tree Collapse file tree 3 files changed +23
-11
lines changed
Expand file tree Collapse file tree 3 files changed +23
-11
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change @@ -600,6 +600,11 @@ export class LocalQueries extends DisposableObject {
600600 }
601601}
602602
603- function isTabInputText ( input : any ) : input is TabInputText {
604- return input ?. uri !== undefined ;
603+ function isTabInputText ( input : unknown ) : input is TabInputText {
604+ return (
605+ input !== null &&
606+ typeof input === "object" &&
607+ "uri" in input &&
608+ input ?. uri !== undefined
609+ ) ;
605610}
You can’t perform that action at this time.
0 commit comments