File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 22import { resultCallback } from '../../lib/result-callback.func' ;
33import { typeOf } from '../../lib/type-of.func' ;
44// Type.
5+ import { Defined } from '../../type/defined.type' ;
56import { IsDefined } from '../type/is-defined.type' ;
67import { ResultCallback } from '../../type/result-callback.type' ;
78/**
8- * Checks if an unknown `value` is NOT an `undefined` type and is NOT equal to `undefined`.
9- * @param value An `unknown` `value` to check.
10- * @param callback `ResultCallback` function to handle result before returns.
9+ * Checks if a generic type `value` is not an `undefined` type and is not equal to `undefined`.
10+ * @param value A generic type `value` to check.
11+ * @param callback A `ResultCallback` function to handle result before returns.
1112 * @returns A `boolean` indicating whether or not the `value` is defined, not `undefined`.
1213 */
13- export const isDefined : IsDefined = ( value : unknown , callback : ResultCallback = resultCallback ) : boolean =>
14+ export const isDefined : IsDefined = < Type > ( value : Type , callback : ResultCallback = resultCallback ) : value is Defined < Type > =>
1415 callback ( typeOf ( value ) !== 'undefined' && typeof value !== 'undefined' && value !== undefined , value ) ;
Original file line number Diff line number Diff line change 1+ import { Defined } from '../../type/defined.type' ;
12import { ResultCallback } from '../../type/result-callback.type' ;
2- export type IsDefined = ( value : unknown , callback ?: ResultCallback ) => boolean ;
3+ export type IsDefined = < Type > ( value : Type , callback ?: ResultCallback ) => value is Defined < Type > ;
You can’t perform that action at this time.
0 commit comments