type R = IsTrue<boolean> // boolean
type R = IsTrue<true> // true
type R = IsTrue<false> // false
type R = IsTrue<number> // false
type R = IsTrue<unknown> // false
type R = IsTrue<string | boolean> // boolean
🔢 customize
Filter to ensure T
is true
, otherwise returns never
.
type R = IsTrue<boolean, { selection: 'filter' }> // true
type R = IsTrue<true, { selection: 'filter' }> // true
type R = IsTrue<false, { selection: 'filter' }> // never
type R = IsTrue<number, { selection: 'filter' }> // never
type R = IsTrue<unknown, { selection: 'filter' }> // never
type R = IsTrue<never, { selection: 'filter' }> // never
type R = IsTrue<string | boolean, { selection: 'filter' }> // true
🔢 customize:
Disable distribution of union types.
type R = IsTrue<true | 1> // boolean
type R = IsTrue<boolean | 1> // boolean
type R = IsTrue<true | 1, { distributive: false }> // false
🔢 customize
Use unique branch identifiers to allow precise processing of the result.
🎭 predicate
Validate if
T
istrue
.