Type Alias $Branch

$Branch: {
    $never: $Never;
}

🧰 type util

$Never.$Branch is the branch option for the $never branch.

It sets the value to $Never, so that the branch can be uniquely identified and handled.

Use this to allow the consumer to customize the behavior of your type.

type YourType<T, $O extends $NeverOptions> = NeverType<T> extends infer R
? R extends $Never
? $ResolveOptions<[$O['$never'], never]>
: HandleOtherBranches<R> // R is narrowed
: never

type R = YourType<T, $Never.$Branch> extends $Never ? HandleNever : HandleOthers