Casts an array to MinLengthTuple<1, E> after checking that it has at least one element.
MinLengthTuple<1, E>
This is the structural counterpart of asNonEmptyArray, and the length-1 specialization of asMinLengthTuple.
asNonEmptyArray
The input array type (tuple types are preserved).
The array to cast.
xs typed as MinLengthTuple<1, Xs[number]> & Xs.
xs
MinLengthTuple<1, Xs[number]> & Xs
const values = Arr.asNonEmptyTuple([1, 2, 3]);const first: number = values[0]; // OK — no `undefined`// Arr.asNonEmptyTuple([]); // throws TypeError Copy
const values = Arr.asNonEmptyTuple([1, 2, 3]);const first: number = values[0]; // OK — no `undefined`// Arr.asNonEmptyTuple([]); // throws TypeError
If xs is empty.
Casts an array to
MinLengthTuple<1, E>after checking that it has at least one element.This is the structural counterpart of
asNonEmptyArray, and the length-1 specialization of asMinLengthTuple.