Skip to content

Commit 0502369

Browse files
refactor: add generic Type and Defined<Type>
1 parent ae7fd5d commit 0502369

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

packages/type/src/guard/lib/guard-defined.func.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ import { ResultCallback } from '../../type/result-callback.type';
1111
* @returns A `boolean` indicating whether or not the `value` is defined, if `undefined` then returns `never`.
1212
*/
1313
export const guardDefined: GuardDefined = <Type>(value: Type, callback?: ResultCallback): value is Defined<Type> =>
14-
isDefined(value, callback);
14+
isDefined<Type>(value, callback);
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
import { Defined } from '../../type/defined.type';
12
import { ResultCallback } from '../../type/result-callback.type';
2-
export type IsDefined = (value: unknown, callback?: ResultCallback) => boolean;
3+
export type IsDefined = <Type>(value: unknown, callback?: ResultCallback) => value is Defined<Type>;

0 commit comments

Comments
 (0)