typelab / assertions / IsUnion
type IsUnion<T> = IfUnion<T, true, false>;Checks if a given type T is union type.
| Type Parameter | Description |
|---|---|
|
|
The type to be checked. |
true if T is union type, false otherwise.
type Valid = IsUnion<string | number>; // true
type Invalid = IsUnion<string>; // false