The minimum number of elements (inclusive). Must be a non-negative integer literal.
The type of elements in the array (defaults to unknown).
const history = [0, 1, 2, 3] as unknown as MutableMinLengthArray<3, number>;
history[0] = 10; // OK — elements are mutable
const first: number = history[0]; // OK — no `undefined` below min(N, 10)
const readonlyView: MinLengthArray<3, number> = history; // OK
// const longer: MutableMinLengthArray<5, number> = history; // Error! (3 < 5)
Mutable counterpart of MinLengthArray: a branded mutable array type for arrays with at least
MinLengthelements.Identical to MinLengthArray except that the clamped structural prefix is mutable (MutableMinLengthTuple instead of MinLengthTuple), so elements can be reassigned. The brand is the same, so a
MutableMinLengthArray<M, Elm>is assignable toMinLengthArray<M, Elm>.This is the mutable, brand-based counterpart of the structural tuple-based
MutableMinLengthTuple; type-checking cost stays essentially independent of the size ofElmand of the bound.