Casts an array to NonEmptyArray<E> after checking that it has at least one
element.
NonEmptyArray<E> is an alias of MinLengthArray<1, E>, so this is the
length-1 specialization of asMinLengthArray. Use this instead of
writing xs as unknown as NonEmptyArray<E>: the length is verified at
runtime, and the original array type (e.g. tuple types) is preserved via
intersection, so the result also benefits from the structural tuple prefix
(xs[0] without undefined under noUncheckedIndexedAccess).
Casts an array to
NonEmptyArray<E>after checking that it has at least one element.NonEmptyArray<E>is an alias ofMinLengthArray<1, E>, so this is the length-1 specialization of asMinLengthArray. Use this instead of writingxs as unknown as NonEmptyArray<E>: the length is verified at runtime, and the original array type (e.g. tuple types) is preserved via intersection, so the result also benefits from the structural tuple prefix (xs[0]withoutundefinedundernoUncheckedIndexedAccess).