Creates a readonly tuple type whose length is between Min and Max (both inclusive).
The result is a union of fixed-length readonly tuples
MakeTuple<Elm, Min> | ... | MakeTuple<Elm, Max>.
Requires Min and Max to be non-negative integer literals with Min <= Max.
Type Parameters
Minextendsnumber
The minimum length (inclusive). Must be a non-negative integer literal.
Maxextendsnumber
The maximum length (inclusive). Must be a non-negative integer literal.
Elm
The type of elements in the tuple.
Returns
A union of readonly tuples whose lengths range from Min to Max.
Example
typeT = ArrayBoundedLen<1, 3, string>; // readonly [string] | readonly [string, string] | readonly [string, string, string] consta: T = ["a"]; // ok constb: T = ["a", "b", "c"]; // ok // const c: T = []; // Error // const d: T = ["a", "b", "c", "d"]; // Error
Creates a readonly tuple type whose length is between
MinandMax(both inclusive). The result is a union of fixed-length readonly tuplesMakeTuple<Elm, Min> | ... | MakeTuple<Elm, Max>. RequiresMinandMaxto be non-negative integer literals withMin <= Max.