File tree Expand file tree Collapse file tree
packages/type/src/guard/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Function.
22import { isBoolean } from '../../is/lib/is-boolean.func' ;
33// Type.
4+ import { AnyBoolean } from '../../type/any-boolean.type' ;
45import { GuardBoolean } from '../type/guard-boolean.type' ;
56import { ResultCallback } from '../../type/result-callback.type' ;
67/**
7- * Guard the `value` to be a ` boolean` .
8+ * Guard the `value` to be any type of a boolean.
89 * @param value A `boolean` type `value` to guard.
9- * @param callback Optional `ResultCallback` function to handle result before returns.
10- * @returns A `boolean` indicating whether or not the `value` is a `boolean`.
10+ * @param callback An optional `ResultCallback` function to handle result before returns.
11+ * @returns A `boolean` indicating whether or not the `value` is a `boolean` or `Boolean` .
1112 */
12- export const guardBoolean : GuardBoolean = ( value : boolean , callback ?: ResultCallback ) : value is boolean =>
13+ export const guardBoolean : GuardBoolean = < B extends AnyBoolean > ( value : B , callback ?: ResultCallback ) : value is B =>
1314 isBoolean ( value , callback ) ;
You can’t perform that action at this time.
0 commit comments