🧰 type util
$Never.$Branch is the branch option for the $never branch.
$Never.$Branch
$never
It sets the value to $Never, so that the branch can be uniquely identified and handled.
$Never
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 : nevertype R = YourType<T, $Never.$Branch> extends $Never ? HandleNever : HandleOthers Copy
type YourType<T, $O extends $NeverOptions> = NeverType<T> extends infer R ? R extends $Never ? $ResolveOptions<[$O['$never'], never]> : HandleOtherBranches<R> // R is narrowed : nevertype R = YourType<T, $Never.$Branch> extends $Never ? HandleNever : HandleOthers
🧰 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.