Skip to main content

UnionToTuple TypeAlias

Converts a union type to a tuple type.

This API is reserved for internal system use and should not be imported directly. It may change at any time without notice.

For more information about our API support guarantees, see here.

Signature

export type UnionToTuple<Union, A extends unknown[] = [], First = PopUnion<Union>> = IsUnion<Union> extends true ? UnionToTuple<Exclude<Union, First>, [First, ...A]> : [Union, ...A];

Type Parameters

Parameter Constraint Default Description
Union
A unknown[] [] Implementation detail: do not specify.
First PopUnion<Union> Implementation detail: do not specify.