Type guard: detect whether a type is a union.
Type to test
Resolves to true if T is a union type, otherwise false.
true
T
false
type A = IsUnion< string | number >; // truetype B = IsUnion< string >; // false Copy
type A = IsUnion< string | number >; // truetype B = IsUnion< string >; // false
Type guard: detect whether a type is a union.