intelephense

1.14.41.16.1
lib/lib.es2023.array.d.ts
lib/lib.es2023.array.d.ts
+81−81
Index: package/lib/lib.es2023.array.d.ts
===================================================================
--- package/lib/lib.es2023.array.d.ts
+++ package/lib/lib.es2023.array.d.ts
@@ -48,9 +48,9 @@
     /**
      * Returns a copy of an array with its elements sorted.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
      * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
-     * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
+     * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
      * ```ts
      * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
      * ```
      */
@@ -126,9 +126,9 @@
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
      * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
-     * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
+     * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
      * ```ts
      * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
      * ```
      */
@@ -162,9 +162,9 @@
      */
     with(index: number, value: T): T[];
 }
 
-interface Int8Array {
+interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -176,14 +176,14 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Int8Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
-        predicate: (value: number, index: number, array: Int8Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number | undefined;
 
     /**
@@ -195,40 +195,40 @@
      * @param thisArg If provided, it will be used as the this value for each invocation of
      * predicate. If it is not provided, undefined is used instead.
      */
     findLastIndex(
-        predicate: (value: number, index: number, array: Int8Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Uint8Array;
+    toReversed(): Int8Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
      * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
      * value otherwise. If omitted, the elements are sorted in ascending order.
      * ```ts
-     * const myNums = Uint8Array.from([11, 2, 22, 1]);
-     * myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22]
+     * const myNums = Int8Array.from([11, 2, 22, 1]);
+     * myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Uint8Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Int8Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Uint8Array;
+    with(index: number, value: number): Int8Array<ArrayBuffer>;
 }
 
-interface Uint8Array {
+interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -240,14 +240,14 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Uint8Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
-        predicate: (value: number, index: number, array: Uint8Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number | undefined;
 
     /**
@@ -259,16 +259,16 @@
      * @param thisArg If provided, it will be used as the this value for each invocation of
      * predicate. If it is not provided, undefined is used instead.
      */
     findLastIndex(
-        predicate: (value: number, index: number, array: Uint8Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Uint8Array;
+    toReversed(): Uint8Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -278,21 +278,21 @@
      * const myNums = Uint8Array.from([11, 2, 22, 1]);
      * myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Uint8Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Uint8Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Uint8Array;
+    with(index: number, value: number): Uint8Array<ArrayBuffer>;
 }
 
-interface Uint8ClampedArray {
+interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -304,17 +304,17 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Uint8ClampedArray,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
         predicate: (
             value: number,
             index: number,
-            array: Uint8ClampedArray,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number | undefined;
 
@@ -330,17 +330,17 @@
     findLastIndex(
         predicate: (
             value: number,
             index: number,
-            array: Uint8ClampedArray,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Uint8ClampedArray;
+    toReversed(): Uint8ClampedArray<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -350,21 +350,21 @@
      * const myNums = Uint8ClampedArray.from([11, 2, 22, 1]);
      * myNums.toSorted((a, b) => a - b) // Uint8ClampedArray(4) [1, 2, 11, 22]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Uint8ClampedArray;
+    toSorted(compareFn?: (a: number, b: number) => number): Uint8ClampedArray<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Uint8ClampedArray;
+    with(index: number, value: number): Uint8ClampedArray<ArrayBuffer>;
 }
 
-interface Int16Array {
+interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -376,14 +376,14 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Int16Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
-        predicate: (value: number, index: number, array: Int16Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number | undefined;
 
     /**
@@ -395,16 +395,16 @@
      * @param thisArg If provided, it will be used as the this value for each invocation of
      * predicate. If it is not provided, undefined is used instead.
      */
     findLastIndex(
-        predicate: (value: number, index: number, array: Int16Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Int16Array;
+    toReversed(): Int16Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -414,21 +414,21 @@
      * const myNums = Int16Array.from([11, 2, -22, 1]);
      * myNums.toSorted((a, b) => a - b) // Int16Array(4) [-22, 1, 2, 11]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Int16Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Int16Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Int16Array;
+    with(index: number, value: number): Int16Array<ArrayBuffer>;
 }
 
-interface Uint16Array {
+interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -440,17 +440,17 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Uint16Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
         predicate: (
             value: number,
             index: number,
-            array: Uint16Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number | undefined;
 
@@ -466,17 +466,17 @@
     findLastIndex(
         predicate: (
             value: number,
             index: number,
-            array: Uint16Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Uint16Array;
+    toReversed(): Uint16Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -486,21 +486,21 @@
      * const myNums = Uint16Array.from([11, 2, 22, 1]);
      * myNums.toSorted((a, b) => a - b) // Uint16Array(4) [1, 2, 11, 22]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Uint16Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Uint16Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Uint16Array;
+    with(index: number, value: number): Uint16Array<ArrayBuffer>;
 }
 
-interface Int32Array {
+interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -512,14 +512,14 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Int32Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
-        predicate: (value: number, index: number, array: Int32Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number | undefined;
 
     /**
@@ -531,16 +531,16 @@
      * @param thisArg If provided, it will be used as the this value for each invocation of
      * predicate. If it is not provided, undefined is used instead.
      */
     findLastIndex(
-        predicate: (value: number, index: number, array: Int32Array) => unknown,
+        predicate: (value: number, index: number, array: this) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Int32Array;
+    toReversed(): Int32Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -550,21 +550,21 @@
      * const myNums = Int32Array.from([11, 2, -22, 1]);
      * myNums.toSorted((a, b) => a - b) // Int32Array(4) [-22, 1, 2, 11]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Int32Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Int32Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Int32Array;
+    with(index: number, value: number): Int32Array<ArrayBuffer>;
 }
 
-interface Uint32Array {
+interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -576,17 +576,17 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Uint32Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
         predicate: (
             value: number,
             index: number,
-            array: Uint32Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number | undefined;
 
@@ -602,17 +602,17 @@
     findLastIndex(
         predicate: (
             value: number,
             index: number,
-            array: Uint32Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Uint32Array;
+    toReversed(): Uint32Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -622,21 +622,21 @@
      * const myNums = Uint32Array.from([11, 2, 22, 1]);
      * myNums.toSorted((a, b) => a - b) // Uint32Array(4) [1, 2, 11, 22]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Uint32Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Uint32Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Uint32Array;
+    with(index: number, value: number): Uint32Array<ArrayBuffer>;
 }
 
-interface Float32Array {
+interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -648,17 +648,17 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Float32Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
         predicate: (
             value: number,
             index: number,
-            array: Float32Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number | undefined;
 
@@ -674,17 +674,17 @@
     findLastIndex(
         predicate: (
             value: number,
             index: number,
-            array: Float32Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Float32Array;
+    toReversed(): Float32Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -694,21 +694,21 @@
      * const myNums = Float32Array.from([11.25, 2, -22.5, 1]);
      * myNums.toSorted((a, b) => a - b) // Float32Array(4) [-22.5, 1, 2, 11.5]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Float32Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Float32Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Float32Array;
+    with(index: number, value: number): Float32Array<ArrayBuffer>;
 }
 
-interface Float64Array {
+interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -720,17 +720,17 @@
     findLast<S extends number>(
         predicate: (
             value: number,
             index: number,
-            array: Float64Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
         predicate: (
             value: number,
             index: number,
-            array: Float64Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number | undefined;
 
@@ -746,17 +746,17 @@
     findLastIndex(
         predicate: (
             value: number,
             index: number,
-            array: Float64Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): Float64Array;
+    toReversed(): Float64Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -766,21 +766,21 @@
      * const myNums = Float64Array.from([11.25, 2, -22.5, 1]);
      * myNums.toSorted((a, b) => a - b) // Float64Array(4) [-22.5, 1, 2, 11.5]
      * ```
      */
-    toSorted(compareFn?: (a: number, b: number) => number): Float64Array;
+    toSorted(compareFn?: (a: number, b: number) => number): Float64Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given number at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: number): Float64Array;
+    with(index: number, value: number): Float64Array<ArrayBuffer>;
 }
 
-interface BigInt64Array {
+interface BigInt64Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -792,17 +792,17 @@
     findLast<S extends bigint>(
         predicate: (
             value: bigint,
             index: number,
-            array: BigInt64Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
         predicate: (
             value: bigint,
             index: number,
-            array: BigInt64Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): bigint | undefined;
 
@@ -818,17 +818,17 @@
     findLastIndex(
         predicate: (
             value: bigint,
             index: number,
-            array: BigInt64Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): BigInt64Array;
+    toReversed(): BigInt64Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -838,21 +838,21 @@
      * const myNums = BigInt64Array.from([11n, 2n, -22n, 1n]);
      * myNums.toSorted((a, b) => Number(a - b)) // BigInt64Array(4) [-22n, 1n, 2n, 11n]
      * ```
      */
-    toSorted(compareFn?: (a: bigint, b: bigint) => number): BigInt64Array;
+    toSorted(compareFn?: (a: bigint, b: bigint) => number): BigInt64Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given bigint at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: bigint): BigInt64Array;
+    with(index: number, value: bigint): BigInt64Array<ArrayBuffer>;
 }
 
-interface BigUint64Array {
+interface BigUint64Array<TArrayBuffer extends ArrayBufferLike> {
     /**
      * Returns the value of the last element in the array where predicate is true, and undefined
      * otherwise.
      * @param predicate findLast calls predicate once for each element of the array, in descending
@@ -864,17 +864,17 @@
     findLast<S extends bigint>(
         predicate: (
             value: bigint,
             index: number,
-            array: BigUint64Array,
+            array: this,
         ) => value is S,
         thisArg?: any,
     ): S | undefined;
     findLast(
         predicate: (
             value: bigint,
             index: number,
-            array: BigUint64Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): bigint | undefined;
 
@@ -890,17 +890,17 @@
     findLastIndex(
         predicate: (
             value: bigint,
             index: number,
-            array: BigUint64Array,
+            array: this,
         ) => unknown,
         thisArg?: any,
     ): number;
 
     /**
      * Copies the array and returns the copy with the elements in reverse order.
      */
-    toReversed(): BigUint64Array;
+    toReversed(): BigUint64Array<ArrayBuffer>;
 
     /**
      * Copies and sorts the array.
      * @param compareFn Function used to determine the order of the elements. It is expected to return
@@ -910,15 +910,15 @@
      * const myNums = BigUint64Array.from([11n, 2n, 22n, 1n]);
      * myNums.toSorted((a, b) => Number(a - b)) // BigUint64Array(4) [1n, 2n, 11n, 22n]
      * ```
      */
-    toSorted(compareFn?: (a: bigint, b: bigint) => number): BigUint64Array;
+    toSorted(compareFn?: (a: bigint, b: bigint) => number): BigUint64Array<ArrayBuffer>;
 
     /**
      * Copies the array and inserts the given bigint at the provided index.
      * @param index The index of the value to overwrite. If the index is
      * negative, then it replaces from the end of the array.
      * @param value The value to insert into the copied array.
      * @returns A copy of the original array with the inserted value.
      */
-    with(index: number, value: bigint): BigUint64Array;
+    with(index: number, value: bigint): BigUint64Array<ArrayBuffer>;
 }