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

      This is the structural counterpart of isEmpty: it narrows to readonly [] rather than to the branded FixedLengthArray<0, E>. Prefer isEmpty 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 []

      true if array.length === 0. When true, TypeScript narrows array to readonly [].

      const values: readonly number[] = [] as const;

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

      assert.isFalse(Arr.isEmptyTuple([1] as const));