The exact number of elements. Must be a non-negative integer literal.
The type of elements in the array (defaults to unknown).
const rgb = [255, 128, 0] as unknown as FixedLengthArray<3, number>;
const atMost5: MaxLengthArray<5, number> = rgb; // OK (3 <= 5)
const nonEmpty: MinLengthArray<1, number> = rgb; // OK (3 >= 1)
const red: number = rgb[0]; // OK — in-range indexed access (N <= 10)
const len: 3 = rgb.length; // `length` is the literal N (N <= 10)
// const rgba: FixedLengthArray<4, number> = rgb; // Error!
Branded readonly array type for arrays with exactly
Lengthelements. Alias forBoundedLengthArray<Length, Length, Elm>.This is the brand-based, lightweight counterpart of the structural tuple-based
FixedLengthTuple; type-checking cost stays essentially independent of the size ofElm. Prefer this type whenElmis a large type or the length is large.For
Length <= 10, the structural part is additionally intersected with the exact tupleFixedLengthTuple<Length, Elm>, solengthis the literalLengthand in-range indexed access does not includeundefinedundernoUncheckedIndexedAccess(and the type is assignable toFixedLengthTuple<Length, Elm>). For larger lengths only the clamped structural prefix inherited from MinLengthArray remains.