ts-data-forge
    Preparing search index...
    • Type guard that checks if an array is non-empty, narrowing it to the structural non-empty tuple.

      This is the structural counterpart of isNonEmpty: it narrows to MinLengthTuple<1, E> rather than to the branded MinLengthArray<1, E>. Prefer isNonEmpty unless you specifically need the structural type.

      Type Parameters

      • E

        The element type.

      Parameters

      • array: readonly E[]

        The array to check.

      Returns array is readonly [E, E]

      true if array.length >= 1. When true, TypeScript narrows array to MinLengthTuple<1, E>.

      const values: readonly number[] = [1, 2] as const;

      assert.isTrue(Arr.isNonEmptyTuple(values));

      assert.isFalse(Arr.isNonEmptyTuple([] as const));