File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -111,16 +111,16 @@ export namespace Functions {
111111 : [ ] ;
112112 }
113113
114+ export function is < T extends object > ( o : T | null | undefined ) : o is T ;
114115 export function is < T extends object > ( o : object , prop : keyof T , value ?: any ) : o is T ;
115116 export function is < T extends object > ( o : object , matcher : ( o : object ) => boolean ) : o is T ;
116117 export function is < T extends object > (
117118 o : object ,
118- propOrMatcher : keyof T | ( ( o : any ) => boolean ) ,
119+ propOrMatcher ? : keyof T | ( ( o : any ) => boolean ) ,
119120 value ?: any
120121 ) : o is T {
121- if ( typeof propOrMatcher === 'function' ) {
122- return propOrMatcher ( o ) ;
123- }
122+ if ( propOrMatcher == null ) return o != null ;
123+ if ( typeof propOrMatcher === 'function' ) return propOrMatcher ( o ) ;
124124
125125 return value === undefined ? ( o as any ) [ propOrMatcher ] !== undefined : ( o as any ) [ propOrMatcher ] === value ;
126126 }
You can’t perform that action at this time.
0 commit comments