Convert a union type to a tuple.
Union type
Internal accumulator (used during recursion)
Produces a tuple containing all members of the union. The resulting order is not guaranteed and should be treated as arbitrary.
Performance degrades for large unions due to recursive conditional types.
type U = 'a' | 'b' | 'c';type Tup = UnionToTuple< U >;// [ 'a', 'b', 'c' ] (order may vary) Copy
type U = 'a' | 'b' | 'c';type Tup = UnionToTuple< U >;// [ 'a', 'b', 'c' ] (order may vary)
Convert a union type to a tuple.