Represents a readonly array that is guaranteed to have at least one element.
Brand-based alias of MinLengthArray<1, A>: unlike the structural
NonEmptyTuple, the non-emptiness is encoded in the brand, so
type-checking cost stays essentially independent of the size of A. Use
NonEmptyTuple instead when a purely structural check is needed (e.g.
T extends NonEmptyTuple<unknown>).
Type Parameters
A
The type of elements in the array.
Example
typeNA = NonEmptyArray<number>; // MinLengthArray<1, number> consthead = (arr: NA): number=>arr[0]; // OK — no `undefined`
Represents a readonly array that is guaranteed to have at least one element.
Brand-based alias of
MinLengthArray<1, A>: unlike the structural NonEmptyTuple, the non-emptiness is encoded in the brand, so type-checking cost stays essentially independent of the size ofA. Use NonEmptyTuple instead when a purely structural check is needed (e.g.T extends NonEmptyTuple<unknown>).