Skip to content

isBoolean

isBoolean(x): x is boolean

Checks if x is a boolean primitive.

Example

isBoolean(true)
// => true
isBoolean("foobar")
// => false

Alternatives

Parameters

x

unknown

The value to check.

Returns

x is boolean

true if x is a boolean, false otherwise.