Creates an array type with a minimum length of N.
N
The first N elements are required, and any additional elements are optional and of the same type T.
T
The element type
The minimum required length
type Result = MinLengthArray<string, 2>;// ^?// [string, string, ...string[]]//@ts-expect-error - requires at least 2 elementsconst invalid: Result = ["hello"]; Copy
type Result = MinLengthArray<string, 2>;// ^?// [string, string, ...string[]]//@ts-expect-error - requires at least 2 elementsconst invalid: Result = ["hello"];
Creates an array type with a minimum length of
N.The first
Nelements are required, and any additional elements are optional and of the same typeT.