Skip to main content

Variable: isBoolean

const isBoolean: TypePredicate<unknown, boolean>

Defined in: predicate/guards/index.ts:137

Type guard that checks if a value is a boolean.

Narrows the type to boolean in TypeScript.

Param

The value to check

Returns

True if value is a boolean

Example

import * as R from 'remeda'
import { isBoolean } from 'receta/predicate'

const mixed: unknown[] = [true, 1, false, 'yes']
const booleans = R.filter(mixed, isBoolean) // type: boolean[]
// => [true, false]

See

  • isString - for string type guard
  • isNumber - for number type guard