asBoolean() function
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Utility function for custom functions. Cast a value as a Boolean, unwrapping objects using their valueOf()
methods. Also accepts 'true'
and 'false'
. Throws a RangeError
for invalid inputs.
Signature:
export declare function asBoolean(value: unknown): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
value | unknown |
Returns:
boolean