Skip to content

isBoolean ​

The isBoolean function checks if the provided value is of boolean type.

Syntax ​

typescript
isBoolean(value: any): value is boolean;

Parameters ​

ParameterTypeDescription
valueanyValue to be checked

Returns ​

TypeDescription
booleanTrue if it is a boolean

Examples ​

typescript
isBoolean(true); // => true
isBoolean(false); // => true
isBoolean(0); // => false

Notes ​

  • Useful for type validation before logical operations.

References ​

Released under the MIT License.