Type guard that checks if an array is non-empty.
const users: readonly { id: number }[] = [{ id: 1 }];const emptyUsers: readonly { id: number }[] = [];assert.ok(Arr.isNonEmpty(users));assert.notOk(Arr.isNonEmpty(emptyUsers));if (Arr.isNonEmpty(users)) { assert.deepStrictEqual(users[0], { id: 1 });} Copy
const users: readonly { id: number }[] = [{ id: 1 }];const emptyUsers: readonly { id: number }[] = [];assert.ok(Arr.isNonEmpty(users));assert.notOk(Arr.isNonEmpty(emptyUsers));if (Arr.isNonEmpty(users)) { assert.deepStrictEqual(users[0], { id: 1 });}
Type guard that checks if an array is non-empty.