ts-data-forge
    Preparing search index...
    • Casts an array to the structural empty tuple after checking that it is empty.

      This is the structural counterpart of asEmptyArray, and the length-0 specialization of asFixedLengthTuple.

      Type Parameters

      • Xs extends readonly unknown[]

        The input array type (tuple types are preserved).

      Parameters

      • xs: Xs

        The array to cast.

      Returns readonly [] & Xs

      xs typed as readonly [] & Xs.

      const nothing = Arr.asEmptyTuple([]);

      // Arr.asEmptyTuple([1]); // throws TypeError

      If xs is not empty.