ts-type-forge
    Preparing search index...

    Type Alias MakeTuple<N, Elm>

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

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

    Type Parameters

    • N extends number

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

    • Elm

      The type of elements in the tuple.

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

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