Skip to main content

isBoolean() function

Determines whether a value is a boolean.

Signature

export declare function isBoolean(value: unknown): boolean;

Parameters

Parameter

Type

Description

value

unknown

The value to test.

Returns

boolean

true if the value is a boolean, false otherwise.

Remarks

Tests for primitive boolean values (true or false). Useful when validating configuration options or parsing JSON where boolean flags need to be distinguished from truthy/falsy values.

Only returns true for the primitive boolean values true and false, not for boolean objects created with new Boolean().

Note: This does not check for truthy or falsy values - it only returns true for actual boolean primitives. Use standard JavaScript truthiness checks for conditional logic.


Generated via tsdoc2docusaurus 1.3.0-pre by API Extractor/Documenter 7.55.2.