Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 604 Bytes

File metadata and controls

43 lines (31 loc) · 604 Bytes

typelab / assertions / IsTruthy

type IsTruthy<T> = _IsTrue<IfTruthy<T, true, false>>;

Checks if a given type T is not `Falsy` or never.

Type Parameters

Type Parameter Description

T

The type to be checked.

Returns

true if T is not `Falsy` or never, false otherwise.

Example

type Valid = IsTruthy<0 | 1>; // true
type Invalid = IsTruthy<0 | 1>; // false