🎭 predicate
Validate if T is undefined or an union with undefined.
T
undefined
type R = HasUndefined<undefined> // truetype R = HasUndefined<undefined | 1> // truetype R = HasUndefined<number> // false Copy
type R = HasUndefined<undefined> // truetype R = HasUndefined<undefined | 1> // truetype R = HasUndefined<number> // false
🔢 customize
Filter to ensure T is undefined or an union with undefined, otherwise returns never.
never
type R = HasUndefined<undefined> // undefinedtype R = HasUndefined<undefined | 1> // undefined | 1type R = HasUndefined<number> // never Copy
type R = HasUndefined<undefined> // undefinedtype R = HasUndefined<undefined | 1> // undefined | 1type R = HasUndefined<number> // never
Use unique branch identifiers to allow precise processing of the result.
type R = HasUndefined<undefined, $SelectionBranch> // $Thentype R = HasUndefined<string, $SelectionBranch> // $Else Copy
type R = HasUndefined<undefined, $SelectionBranch> // $Thentype R = HasUndefined<string, $SelectionBranch> // $Else
🎭 predicate
Validate if
T
isundefined
or an union withundefined
.