API reference › @evolu/common › Assert › assertNonEmptyArray
const assertNonEmptyArray: <T>(
arr: T[],
message?: string,
) => asserts arr is [T, ...T[]];
Defined in: packages/common/src/Assert.ts:52
Asserts that an array is non-empty.
Ensures the provided array has at least one element, helping TypeScript infer the array as non-empty when this is logically guaranteed but not statically known.
Example
assertNonEmptyArray([1, 2, 3]); // no-op
assertNonEmptyArray([]); // throws Error