types-kit.tupletounion.md
September 4, 2023 ยท View on GitHub
Home > types-kit > TupleToUnion
TupleToUnion type
Convert a tuple to union type.
Signature:
export type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never
Example
// Expect: string | number
type Foo = TupleToUnion<[string, number]>