Type Alias IsTrue<T, $O>

IsTrue<T, $O>: $SpecialType<T, $MergeOptions<$O, {
    $else: IsTrue.$<T, $O>;
    $then: $ResolveBranch<T, $O, [$Else]>;
}>>

🎭 predicate

Validate if T is true.

Type Parameters

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.

type R = IsTrue<true, $SelectionBranch> // $Then
type R = IsTrue<boolean, $SelectionBranch> // $Then | $Else
type R = IsTrue<string, $SelectionBranch> // $Else