ts-type-forge
    Preparing search index...

    Type Alias MakeTuple<Elm, N>

    MakeTuple: MakeTupleImpl<Elm, `${N}`, []>

    Creates a readonly tuple type of a specific length N with elements of type Elm.

    Type Parameters

    • Elm

      The type of elements in the tuple.

    • N extends number

      The desired length of the tuple (must be a non-negative integer literal).

    A readonly tuple type readonly [Elm, Elm, ..., Elm] of length N.

    type TupleOf3Strings = MakeTuple<string, 3>; // readonly [string, string, string]
    type TupleOf0Numbers = MakeTuple<number, 0>; // readonly []
    // type InvalidLength = MakeTuple<boolean, -1>; // Error or unexpected result
    // type InvalidLength2 = MakeTuple<boolean, 1.5>; // Error or unexpected result