The minimum number of elements (inclusive). Must be a non-negative integer literal.
The maximum number of elements (inclusive). Must be a non-negative integer literal.
The type of elements in the array (defaults to unknown).
const selection = [1, 2, 3] as unknown as MutableBoundedLengthArray<
1,
5,
number
>;
selection[0] = 10; // OK — elements are mutable
const relaxed: BoundedLengthArray<0, 100, number> = selection; // OK ([1, 5] ⊆ [0, 100])
// const strict: MutableBoundedLengthArray<2, 5, number> = selection; // Error! (1 < 2)
Mutable counterpart of BoundedLengthArray: a branded mutable array type for arrays whose length is between
MinLengthandMaxLengthelements (both inclusive). Defined as the intersection of MutableMinLengthArray and MutableMaxLengthArray, so the clamped structural prefix stays mutable and both bounds can be weakened independently. The brand is the same as BoundedLengthArray, so aMutableBoundedLengthArray<M1, M2, Elm>is assignable toBoundedLengthArray<M1, M2, Elm>.