The minimum number of elements (inclusive).
The input array type (tuple types are preserved).
xs typed as MinLengthTuple<MinLength, Xs[number]> & Xs.
const history = Arr.asMinLengthTuple(3, [0, 1, 2, 3]);
const first: number = history[0]; // OK — no `undefined`
// curried version
const asHistory = Arr.asMinLengthTuple(3);
assert.strictEqual(first, 0);
assert.deepStrictEqual(asHistory([4, 5, 6]), [4, 5, 6]);
assert.throws(() => Arr.asMinLengthTuple(3, [0, 1]), TypeError);
Casts an array to MinLengthTuple<MinLength, E> after checking that it has
at least minLength elements.
This is the structural counterpart of asMinLengthArray; see
asFixedLengthTuple for when to prefer which.
The minimum number of elements (inclusive).
The minimum number of elements (inclusive).
xs typed as MinLengthTuple<MinLength, Xs[number]> & Xs.
const history = Arr.asMinLengthTuple(3, [0, 1, 2, 3]);
const first: number = history[0]; // OK — no `undefined`
// curried version
const asHistory = Arr.asMinLengthTuple(3);
assert.strictEqual(first, 0);
assert.deepStrictEqual(asHistory([4, 5, 6]), [4, 5, 6]);
assert.throws(() => Arr.asMinLengthTuple(3, [0, 1]), TypeError);
Casts an array to
MinLengthTuple<MinLength, E>after checking that it has at leastminLengthelements.This is the structural counterpart of
asMinLengthArray; see asFixedLengthTuple for when to prefer which.