devtypes
    Preparing search index...

    Type Alias UnionToTuple<U, T>

    UnionToTuple: [U] extends [never]
        ? T
        : UnionToTuple<Exclude<U, Last<U>>, [Last<U>, ...T]>

    Union to tuple (order not guaranteed). Good for small unions.

    Type Parameters

    • U
    • T extends any[] = []
    type U = 'a' | 'b' | 'c';
    type Tup = UnionToTuple<U>; // ['a', 'b', 'c']