ts-uf

boolean

validation

isBoolean

function isBoolean<T>(value: CheckT<T>): value is SmartExtract<T, boolean>;

Checks whether a value is a boolean.

Example
function foo(value: boolean | { a: boolean; b: boolean }) {
	if (isBoolean(value)) {
		value; // boolean
	}
}

isNotBoolean

function isNotBoolean<T>(value: CheckT<T>): value is Exclude<T, boolean>;

Checks whether a value is not a boolean.

Example
function foo(value: boolean | { a: boolean; b: boolean }) {
	if (isNotBoolean(value)) {
		value; // { a: boolean, b: boolean }
	}
}

isTrue

function isTrue<T>(value: CheckT<T>): value is SmartExtract<T, true>;

Checks whether a value is true.

isNotTrue

function isNotTrue<T>(value: CheckT<T>): value is Exclude<T, true>;

Checks whether a value is not true.

isFalse

function isFalse<T>(value: CheckT<T>): value is SmartExtract<T, false>;

Checks whether a value is false.

isNotFalse

function isNotFalse<T>(value: CheckT<T>): value is Exclude<T, false>;

Checks whether a value is false.

isTruthy

function isTruthy(value: unknown): boolean;

Checks whether a value is truthy.

isFalsy

function isFalsy(value: unknown): boolean;

Checks whether a value is falsy.

utils

not

function not(value: boolean): boolean;

Negates a boolean.

On this page