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