Skip to content

assertArrayNotEmpty

Assert that an array has at least one element, with type-narrowing.

import { assertArrayNotEmpty } from "@kensio/smartass";
const value: unknown = ["admin"];
assertArrayNotEmpty(value);
// value is now narrowed to a non-empty array

Source file: src/assert/array-not-empty/array-not-empty.assert.ts