summaryrefslogtreecommitdiff
path: root/cli/tsc/dts/lib.es2023.array.d.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-09-09 14:03:21 -0500
committerGitHub <noreply@github.com>2023-09-09 15:03:21 -0400
commitc228adc27d5b605286d3a9ca924e657308aebb74 (patch)
treefdc0e814bdaeceb231565ee8e0324c7447c39212 /cli/tsc/dts/lib.es2023.array.d.ts
parentf75a17521df053218c0c2b5fb93c5354f9c8f274 (diff)
feat: TypeScript 5.2 (#20425)
Without `using` declarations or decorator metadata (waiting for that in v8).
Diffstat (limited to 'cli/tsc/dts/lib.es2023.array.d.ts')
-rw-r--r--cli/tsc/dts/lib.es2023.array.d.ts654
1 files changed, 618 insertions, 36 deletions
diff --git a/cli/tsc/dts/lib.es2023.array.d.ts b/cli/tsc/dts/lib.es2023.array.d.ts
index 9b01b26bd..d8d5cc9cb 100644
--- a/cli/tsc/dts/lib.es2023.array.d.ts
+++ b/cli/tsc/dts/lib.es2023.array.d.ts
@@ -39,6 +39,50 @@ interface Array<T> {
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): number;
+
+ /**
+ * Returns a copy of an array with its elements reversed.
+ */
+ toReversed(): T[];
+
+ /**
+ * 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.
+ * ```ts
+ * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
+ * ```
+ */
+ toSorted(compareFn?: (a: T, b: T) => number): T[];
+
+ /**
+ * Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.
+ * @param start The zero-based location in the array from which to start removing elements.
+ * @param deleteCount The number of elements to remove.
+ * @param items Elements to insert into the copied array in place of the deleted elements.
+ * @returns The copied array.
+ */
+ toSpliced(start: number, deleteCount: number, ...items: T[]): T[];
+
+ /**
+ * Copies an array and removes elements while returning the remaining elements.
+ * @param start The zero-based location in the array from which to start removing elements.
+ * @param deleteCount The number of elements to remove.
+ * @returns A copy of the original array with the remaining elements.
+ */
+ toSpliced(start: number, deleteCount?: number): T[];
+
+ /**
+ * Copies an array, then overwrites the value at the provided index with the
+ * given value. If the index is negative, then it replaces from the end
+ * of the array.
+ * @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 write into the copied array.
+ * @returns The copied array with the updated value.
+ */
+ with(index: number, value: T): T[];
}
interface ReadonlyArray<T> {
@@ -51,8 +95,14 @@ interface ReadonlyArray<T> {
* @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.
*/
- findLast<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T | undefined;
+ findLast<S extends T>(
+ predicate: (value: T, index: number, array: readonly T[]) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (value: T, index: number, array: readonly T[]) => unknown,
+ thisArg?: any
+ ): T | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -63,7 +113,54 @@ interface ReadonlyArray<T> {
* @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: T, index: number, array: readonly T[]) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (value: T, index: number, array: readonly T[]) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copied array with all of its elements reversed.
+ */
+ toReversed(): T[];
+
+ /**
+ * 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.
+ * ```ts
+ * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
+ * ```
+ */
+ toSorted(compareFn?: (a: T, b: T) => number): T[];
+
+ /**
+ * Copies an array and removes elements while, if necessary, inserting new elements in their place, returning the remaining elements.
+ * @param start The zero-based location in the array from which to start removing elements.
+ * @param deleteCount The number of elements to remove.
+ * @param items Elements to insert into the copied array in place of the deleted elements.
+ * @returns A copy of the original array with the remaining elements.
+ */
+ toSpliced(start: number, deleteCount: number, ...items: T[]): T[];
+
+ /**
+ * Copies an array and removes elements while returning the remaining elements.
+ * @param start The zero-based location in the array from which to start removing elements.
+ * @param deleteCount The number of elements to remove.
+ * @returns A copy of the original array with the remaining elements.
+ */
+ toSpliced(start: number, deleteCount?: number): T[];
+
+ /**
+ * Copies an array, then overwrites the value at the provided index with the
+ * given value. If the index is negative, then it replaces from the end
+ * of the array
+ * @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: T): T[];
}
interface Int8Array {
@@ -76,8 +173,18 @@ interface Int8Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Int8Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Int8Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (value: number, index: number, array: Int8Array) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -88,7 +195,36 @@ interface Int8Array {
* @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, thisArg?: any): number;
+ findLastIndex(
+ predicate: (value: number, index: number, array: Int8Array) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Uint8Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Uint8Array {
@@ -101,8 +237,18 @@ interface Uint8Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint8Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (value: number, index: number, array: Uint8Array) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -113,7 +259,36 @@ interface Uint8Array {
* @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, thisArg?: any): number;
+ findLastIndex(
+ predicate: (value: number, index: number, array: Uint8Array) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Uint8Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Uint8ClampedArray {
@@ -126,8 +301,22 @@ interface Uint8ClampedArray {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Uint8ClampedArray) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint8ClampedArray
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint8ClampedArray
+ ) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -138,7 +327,40 @@ interface Uint8ClampedArray {
* @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: Uint8ClampedArray) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint8ClampedArray
+ ) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Uint8ClampedArray;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Int16Array {
@@ -151,8 +373,18 @@ interface Int16Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Int16Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Int16Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (value: number, index: number, array: Int16Array) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -163,7 +395,36 @@ interface Int16Array {
* @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, thisArg?: any): number;
+ findLastIndex(
+ predicate: (value: number, index: number, array: Int16Array) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Int16Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Uint16Array {
@@ -176,8 +437,22 @@ interface Uint16Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Uint16Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint16Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint16Array
+ ) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -188,7 +463,40 @@ interface Uint16Array {
* @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: Uint16Array) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint16Array
+ ) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Uint16Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Int32Array {
@@ -201,8 +509,18 @@ interface Int32Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Int32Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Int32Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (value: number, index: number, array: Int32Array) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -213,7 +531,36 @@ interface Int32Array {
* @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, thisArg?: any): number;
+ findLastIndex(
+ predicate: (value: number, index: number, array: Int32Array) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Int32Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Uint32Array {
@@ -226,8 +573,22 @@ interface Uint32Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Uint32Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint32Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint32Array
+ ) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -238,7 +599,40 @@ interface Uint32Array {
* @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: Uint32Array) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (
+ value: number,
+ index: number,
+ array: Uint32Array
+ ) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Uint32Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Float32Array {
@@ -251,8 +645,22 @@ interface Float32Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Float32Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Float32Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (
+ value: number,
+ index: number,
+ array: Float32Array
+ ) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -263,7 +671,40 @@ interface Float32Array {
* @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: Float32Array) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (
+ value: number,
+ index: number,
+ array: Float32Array
+ ) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Float32Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface Float64Array {
@@ -276,8 +717,22 @@ interface Float64Array {
* @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.
*/
- findLast<S extends number>(predicate: (value: number, index: number, array: Float64Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): number | undefined;
+ findLast<S extends number>(
+ predicate: (
+ value: number,
+ index: number,
+ array: Float64Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (
+ value: number,
+ index: number,
+ array: Float64Array
+ ) => unknown,
+ thisArg?: any
+ ): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -288,7 +743,40 @@ interface Float64Array {
* @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: Float64Array) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (
+ value: number,
+ index: number,
+ array: Float64Array
+ ) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): Float64Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface BigInt64Array {
@@ -301,8 +789,22 @@ interface BigInt64Array {
* @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.
*/
- findLast<S extends bigint>(predicate: (value: bigint, index: number, array: BigInt64Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): bigint | undefined;
+ findLast<S extends bigint>(
+ predicate: (
+ value: bigint,
+ index: number,
+ array: BigInt64Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (
+ value: bigint,
+ index: number,
+ array: BigInt64Array
+ ) => unknown,
+ thisArg?: any
+ ): bigint | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -313,7 +815,40 @@ interface BigInt64Array {
* @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: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (
+ value: bigint,
+ index: number,
+ array: BigInt64Array
+ ) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): BigInt64Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}
interface BigUint64Array {
@@ -326,8 +861,22 @@ interface BigUint64Array {
* @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.
*/
- findLast<S extends bigint>(predicate: (value: bigint, index: number, array: BigUint64Array) => value is S, thisArg?: any): S | undefined;
- findLast(predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): bigint | undefined;
+ findLast<S extends bigint>(
+ predicate: (
+ value: bigint,
+ index: number,
+ array: BigUint64Array
+ ) => value is S,
+ thisArg?: any
+ ): S | undefined;
+ findLast(
+ predicate: (
+ value: bigint,
+ index: number,
+ array: BigUint64Array
+ ) => unknown,
+ thisArg?: any
+ ): bigint | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
@@ -338,5 +887,38 @@ interface BigUint64Array {
* @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: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): number;
+ findLastIndex(
+ predicate: (
+ value: bigint,
+ index: number,
+ array: BigUint64Array
+ ) => unknown,
+ thisArg?: any
+ ): number;
+
+ /**
+ * Copies the array and returns the copy with the elements in reverse order.
+ */
+ toReversed(): BigUint64Array;
+
+ /**
+ * 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.
+ * ```ts
+ * 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;
+
+ /**
+ * 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;
}