Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 543 Bytes

File metadata and controls

45 lines (32 loc) · 543 Bytes

typelab / utils / UnionToTuple

type UnionToTuple<T> = _UnionToTuple<T, UnionLast<T>>;

Converts a union type to a Tuple.

⚠️ Does not guarantee correct order.

Type Parameters

Type Parameter Description

T

The union type.

Returns

A Tuple containing all the types in the union.

Example

// ['a', 'b', 'c']
type Tupl = UnionToTuple<'a' | 'b' | 'c'>;