Type Alias IsNever<T, $O>

IsNever<T, $O>: $SpecialType<T, {
    $any: $ResolveBranch<T, IsNever._O<$O>, [$Any, $Else]>;
    $else: $ResolveBranch<T, IsNever._O<$O>, [$Else]>;
    $never: $ResolveBranch<T, $O, [$Then]>;
    $unknown: $ResolveBranch<T, IsNever._O<$O>, [$Unknown, $Else]>;
}>

🎭 predicate

Validate if T is never.

Type Parameters

type R = IsNever<never> // true

type R = IsNever<1> // false

🔢 customize

Filter to ensure T is never, otherwise returns $NotNever.

Filter normally returns never in the $else clause. But since we are checking for never here, we have to return $NotNever instead.

type R = IsNever<never, { selection: 'filter' }> // never

type R = IsNever<1, { selection: 'filter' }> // $NotNever

🔢 customize

Use unique branch identifiers to allow precise processing of the result.

type R = IsNever<never, $SelectionBranch> // $Then
type R = IsNever<1, $SelectionBranch> // $Else