Skip to main content

UnionToTuple TypeAlias

Converts a union type to a tuple type.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

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.