utilitypes-ts
    Preparing search index...

    Type Alias Tuple<T, N>

    Tuple: BuildTuple<T, N, []>

    Creates a tuple of length N where each element is of type T.

    If N is a specific number literal, the result is a fixed-length tuple. If N is the general number type, the result falls back to T[].

    Type Parameters

    • T

      The element type

    • N extends number

      The desired tuple length

    type Result = Tuple<string, 3>;
    // ^?
    // [string, string, string]
    type Result = Tuple<boolean, number>;
    // ^?
    // boolean[]
    type Result = Tuple<number, 0>;
    // ^?
    // []