Type Alias IsNotNever<T, $O>

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

🎭 predicate

Validate if T not never.

Type Parameters

type R = IsNotNever<1> // true

type R = IsNotNever<never> // false

🔢 customize

Filter to ensure T is not never, otherwise returns $Never.

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

type R = IsNotNever<1, { selection: 'filter' }> // 1

type R = IsNotNever<never, { selection: 'filter' }> // $Never

🔢 customize

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

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