Make typed arrays generic over ArrayBufferLike (#59417)

This commit is contained in:
Ron Buckton
2024-09-24 12:17:59 -04:00
committed by GitHub
parent fa0080f480
commit e5758ab8b1
63 changed files with 33167 additions and 3943 deletions

View File

@@ -542,38 +542,38 @@ interface StringConstructor {
raw(template: { raw: readonly string[] | ArrayLike<string>; }, ...substitutions: any[]): string;
}
interface Int8Array {
interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Uint8Array {
interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Uint8ClampedArray {
interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Int16Array {
interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Uint16Array {
interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Int32Array {
interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Uint32Array {
interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Float32Array {
interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
interface Float64Array {
interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

View File

@@ -252,7 +252,7 @@ interface String {
[Symbol.iterator](): StringIterator<string>;
}
interface Int8Array {
interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -269,7 +269,7 @@ interface Int8Array {
}
interface Int8ArrayConstructor {
new (elements: Iterable<number>): Int8Array;
new (elements: Iterable<number>): Int8Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -277,10 +277,17 @@ interface Int8ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
from(arrayLike: Iterable<number>): Int8Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int8Array<ArrayBuffer>;
}
interface Uint8Array {
interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -297,7 +304,7 @@ interface Uint8Array {
}
interface Uint8ArrayConstructor {
new (elements: Iterable<number>): Uint8Array;
new (elements: Iterable<number>): Uint8Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -305,10 +312,17 @@ interface Uint8ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
from(arrayLike: Iterable<number>): Uint8Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
}
interface Uint8ClampedArray {
interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -327,7 +341,7 @@ interface Uint8ClampedArray {
}
interface Uint8ClampedArrayConstructor {
new (elements: Iterable<number>): Uint8ClampedArray;
new (elements: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -335,10 +349,17 @@ interface Uint8ClampedArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
from(arrayLike: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray<ArrayBuffer>;
}
interface Int16Array {
interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -357,7 +378,7 @@ interface Int16Array {
}
interface Int16ArrayConstructor {
new (elements: Iterable<number>): Int16Array;
new (elements: Iterable<number>): Int16Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -365,10 +386,17 @@ interface Int16ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
from(arrayLike: Iterable<number>): Int16Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int16Array<ArrayBuffer>;
}
interface Uint16Array {
interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -385,7 +413,7 @@ interface Uint16Array {
}
interface Uint16ArrayConstructor {
new (elements: Iterable<number>): Uint16Array;
new (elements: Iterable<number>): Uint16Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -393,10 +421,17 @@ interface Uint16ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
from(arrayLike: Iterable<number>): Uint16Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint16Array<ArrayBuffer>;
}
interface Int32Array {
interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -413,7 +448,7 @@ interface Int32Array {
}
interface Int32ArrayConstructor {
new (elements: Iterable<number>): Int32Array;
new (elements: Iterable<number>): Int32Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -421,10 +456,17 @@ interface Int32ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
from(arrayLike: Iterable<number>): Int32Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int32Array<ArrayBuffer>;
}
interface Uint32Array {
interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -441,7 +483,7 @@ interface Uint32Array {
}
interface Uint32ArrayConstructor {
new (elements: Iterable<number>): Uint32Array;
new (elements: Iterable<number>): Uint32Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -449,10 +491,17 @@ interface Uint32ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
from(arrayLike: Iterable<number>): Uint32Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint32Array<ArrayBuffer>;
}
interface Float32Array {
interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -469,7 +518,7 @@ interface Float32Array {
}
interface Float32ArrayConstructor {
new (elements: Iterable<number>): Float32Array;
new (elements: Iterable<number>): Float32Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -477,10 +526,17 @@ interface Float32ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
from(arrayLike: Iterable<number>): Float32Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float32Array<ArrayBuffer>;
}
interface Float64Array {
interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
[Symbol.iterator](): ArrayIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -497,7 +553,7 @@ interface Float64Array {
}
interface Float64ArrayConstructor {
new (elements: Iterable<number>): Float64Array;
new (elements: Iterable<number>): Float64Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -505,5 +561,12 @@ interface Float64ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
from(arrayLike: Iterable<number>): Float64Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T>(arrayLike: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float64Array<ArrayBuffer>;
}

View File

@@ -254,43 +254,43 @@ interface ArrayBuffer {
readonly [Symbol.toStringTag]: string;
}
interface DataView {
interface DataView<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: string;
}
interface Int8Array {
interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Int8Array";
}
interface Uint8Array {
interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Uint8Array";
}
interface Uint8ClampedArray {
interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Uint8ClampedArray";
}
interface Int16Array {
interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Int16Array";
}
interface Uint16Array {
interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Uint16Array";
}
interface Int32Array {
interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Int32Array";
}
interface Uint32Array {
interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Uint32Array";
}
interface Float32Array {
interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Float32Array";
}
interface Float64Array {
interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
readonly [Symbol.toStringTag]: "Float64Array";
}

View File

@@ -16,7 +16,7 @@ interface ReadonlyArray<T> {
includes(searchElement: T, fromIndex?: number): boolean;
}
interface Int8Array {
interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -25,7 +25,7 @@ interface Int8Array {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint8Array {
interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -34,7 +34,7 @@ interface Uint8Array {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint8ClampedArray {
interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -43,7 +43,7 @@ interface Uint8ClampedArray {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Int16Array {
interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -52,7 +52,7 @@ interface Int16Array {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint16Array {
interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -61,7 +61,7 @@ interface Uint16Array {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Int32Array {
interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -70,7 +70,7 @@ interface Int32Array {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint32Array {
interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -79,7 +79,7 @@ interface Uint32Array {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Float32Array {
interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
@@ -88,7 +88,7 @@ interface Float32Array {
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Float64Array {
interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.

View File

@@ -31,28 +31,28 @@ interface Atomics {
* Until this atomic operation completes, any other read or write operation against the array
* will block.
*/
add(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
add(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;
/**
* Stores the bitwise AND of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or
* write operation against the array will block.
*/
and(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
and(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;
/**
* Replaces the value at the given position in the array if the original value equals the given
* expected value, returning the original value. Until this atomic operation completes, any
* other read or write operation against the array will block.
*/
compareExchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, expectedValue: number, replacementValue: number): number;
compareExchange(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, expectedValue: number, replacementValue: number): number;
/**
* Replaces the value at the given position in the array, returning the original value. Until
* this atomic operation completes, any other read or write operation against the array will
* block.
*/
exchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
exchange(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;
/**
* Returns a value indicating whether high-performance algorithms can use atomic operations
@@ -65,27 +65,27 @@ interface Atomics {
* Returns the value at the given position in the array. Until this atomic operation completes,
* any other read or write operation against the array will block.
*/
load(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number): number;
load(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number): number;
/**
* Stores the bitwise OR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
or(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
or(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;
/**
* Stores a value at the given position in the array, returning the new value. Until this
* atomic operation completes, any other read or write operation against the array will block.
*/
store(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
store(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;
/**
* Subtracts a value from the value at the given position in the array, returning the original
* value. Until this atomic operation completes, any other read or write operation against the
* array will block.
*/
sub(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
sub(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;
/**
* If the value at the given position in the array is equal to the provided value, the current
@@ -93,23 +93,23 @@ interface Atomics {
* `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns
* `"not-equal"`.
*/
wait(typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out";
wait(typedArray: Int32Array<ArrayBufferLike>, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out";
/**
* Wakes up sleeping agents that are waiting on the given index of the array, returning the
* number of agents that were awoken.
* @param typedArray A shared Int32Array.
* @param typedArray A shared Int32Array<ArrayBufferLike>.
* @param index The position in the typedArray to wake up on.
* @param count The number of sleeping agents to notify. Defaults to +Infinity.
*/
notify(typedArray: Int32Array, index: number, count?: number): number;
notify(typedArray: Int32Array<ArrayBufferLike>, index: number, count?: number): number;
/**
* Stores the bitwise XOR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
xor(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
xor(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;
readonly [Symbol.toStringTag]: "Atomics";
}

View File

@@ -1,35 +1,35 @@
interface Int8ArrayConstructor {
new (): Int8Array;
new (): Int8Array<ArrayBuffer>;
}
interface Uint8ArrayConstructor {
new (): Uint8Array;
new (): Uint8Array<ArrayBuffer>;
}
interface Uint8ClampedArrayConstructor {
new (): Uint8ClampedArray;
new (): Uint8ClampedArray<ArrayBuffer>;
}
interface Int16ArrayConstructor {
new (): Int16Array;
new (): Int16Array<ArrayBuffer>;
}
interface Uint16ArrayConstructor {
new (): Uint16Array;
new (): Uint16Array<ArrayBuffer>;
}
interface Int32ArrayConstructor {
new (): Int32Array;
new (): Int32Array<ArrayBuffer>;
}
interface Uint32ArrayConstructor {
new (): Uint32Array;
new (): Uint32Array<ArrayBuffer>;
}
interface Float32ArrayConstructor {
new (): Float32Array;
new (): Float32Array<ArrayBuffer>;
}
interface Float64ArrayConstructor {
new (): Float64Array;
new (): Float64Array<ArrayBuffer>;
}

View File

@@ -128,12 +128,12 @@ declare var BigInt: BigIntConstructor;
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
* requested number of bytes could not be allocated, an exception is raised.
*/
interface BigInt64Array {
interface BigInt64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/** The ArrayBuffer instance referenced by the array. */
readonly buffer: ArrayBufferLike;
readonly buffer: TArrayBuffer;
/** The length in bytes of the array. */
readonly byteLength: number;
@@ -163,7 +163,7 @@ interface BigInt64Array {
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
every(predicate: (value: bigint, index: number, array: BigInt64Array<TArrayBuffer>) => boolean, thisArg?: any): boolean;
/**
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
@@ -182,7 +182,7 @@ interface BigInt64Array {
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(predicate: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array;
filter(predicate: (value: bigint, index: number, array: BigInt64Array<TArrayBuffer>) => any, thisArg?: any): BigInt64Array<ArrayBuffer>;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@@ -193,7 +193,7 @@ 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.
*/
find(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): bigint | undefined;
find(predicate: (value: bigint, index: number, array: BigInt64Array<TArrayBuffer>) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
@@ -204,7 +204,7 @@ 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.
*/
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): number;
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array<TArrayBuffer>) => boolean, thisArg?: any): number;
/**
* Performs the specified action for each element in an array.
@@ -213,7 +213,7 @@ interface BigInt64Array {
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, thisArg?: any): void;
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array<TArrayBuffer>) => void, thisArg?: any): void;
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
@@ -259,7 +259,7 @@ interface BigInt64Array {
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
map(callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, thisArg?: any): BigInt64Array;
map(callbackfn: (value: bigint, index: number, array: BigInt64Array<TArrayBuffer>) => bigint, thisArg?: any): BigInt64Array<ArrayBuffer>;
/**
* Calls the specified callback function for all the elements in an array. The return value of
@@ -271,7 +271,7 @@ interface BigInt64Array {
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array<TArrayBuffer>) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array. The return value of
@@ -283,7 +283,7 @@ interface BigInt64Array {
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array<TArrayBuffer>) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
@@ -295,7 +295,7 @@ interface BigInt64Array {
* the accumulation. The first call to the callbackfn function provides this value as an
* argument instead of an array value.
*/
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array<TArrayBuffer>) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
@@ -307,7 +307,7 @@ interface BigInt64Array {
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array<TArrayBuffer>) => U, initialValue: U): U;
/** Reverses the elements in the array. */
reverse(): this;
@@ -324,7 +324,7 @@ interface BigInt64Array {
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice(start?: number, end?: number): BigInt64Array;
slice(start?: number, end?: number): BigInt64Array<ArrayBuffer>;
/**
* Determines whether the specified callback function returns true for any element of an array.
@@ -334,7 +334,7 @@ interface BigInt64Array {
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
some(predicate: (value: bigint, index: number, array: BigInt64Array<TArrayBuffer>) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
@@ -348,7 +348,7 @@ interface BigInt64Array {
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin?: number, end?: number): BigInt64Array;
subarray(begin?: number, end?: number): BigInt64Array<TArrayBuffer>;
/** Converts the array to a string by using the current locale. */
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
@@ -357,7 +357,7 @@ interface BigInt64Array {
toString(): string;
/** Returns the primitive value of the specified object. */
valueOf(): BigInt64Array;
valueOf(): BigInt64Array<TArrayBuffer>;
/** Yields each value in the array. */
values(): ArrayIterator<bigint>;
@@ -368,12 +368,11 @@ interface BigInt64Array {
[index: number]: bigint;
}
interface BigInt64ArrayConstructor {
readonly prototype: BigInt64Array;
new (length?: number): BigInt64Array;
new (array: Iterable<bigint>): BigInt64Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array;
readonly prototype: BigInt64Array<ArrayBufferLike>;
new (length?: number): BigInt64Array<ArrayBuffer>;
new (array: ArrayLike<bigint> | Iterable<bigint>): BigInt64Array<ArrayBuffer>;
new <TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(buffer: TArrayBuffer, byteOffset?: number, length?: number): BigInt64Array<TArrayBuffer>;
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
@@ -382,7 +381,7 @@ interface BigInt64ArrayConstructor {
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of(...items: bigint[]): BigInt64Array;
of(...items: bigint[]): BigInt64Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -390,22 +389,27 @@ interface BigInt64ArrayConstructor {
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: ArrayLike<bigint>): BigInt64Array;
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array;
from(arrayLike: ArrayLike<bigint>): BigInt64Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array<ArrayBuffer>;
}
declare var BigInt64Array: BigInt64ArrayConstructor;
/**
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
* requested number of bytes could not be allocated, an exception is raised.
*/
interface BigUint64Array {
interface BigUint64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/** The ArrayBuffer instance referenced by the array. */
readonly buffer: ArrayBufferLike;
readonly buffer: TArrayBuffer;
/** The length in bytes of the array. */
readonly byteLength: number;
@@ -435,7 +439,7 @@ interface BigUint64Array {
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
every(predicate: (value: bigint, index: number, array: BigUint64Array<TArrayBuffer>) => boolean, thisArg?: any): boolean;
/**
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
@@ -454,7 +458,7 @@ interface BigUint64Array {
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(predicate: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array;
filter(predicate: (value: bigint, index: number, array: BigUint64Array<TArrayBuffer>) => any, thisArg?: any): BigUint64Array<ArrayBuffer>;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@@ -465,7 +469,7 @@ 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.
*/
find(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): bigint | undefined;
find(predicate: (value: bigint, index: number, array: BigUint64Array<TArrayBuffer>) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
@@ -476,7 +480,7 @@ 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.
*/
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): number;
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array<TArrayBuffer>) => boolean, thisArg?: any): number;
/**
* Performs the specified action for each element in an array.
@@ -485,7 +489,7 @@ interface BigUint64Array {
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, thisArg?: any): void;
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array<TArrayBuffer>) => void, thisArg?: any): void;
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
@@ -531,7 +535,7 @@ interface BigUint64Array {
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
map(callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, thisArg?: any): BigUint64Array;
map(callbackfn: (value: bigint, index: number, array: BigUint64Array<TArrayBuffer>) => bigint, thisArg?: any): BigUint64Array<ArrayBuffer>;
/**
* Calls the specified callback function for all the elements in an array. The return value of
@@ -543,7 +547,7 @@ interface BigUint64Array {
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array<TArrayBuffer>) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array. The return value of
@@ -555,7 +559,7 @@ interface BigUint64Array {
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array<TArrayBuffer>) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
@@ -567,7 +571,7 @@ interface BigUint64Array {
* the accumulation. The first call to the callbackfn function provides this value as an
* argument instead of an array value.
*/
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array<TArrayBuffer>) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
@@ -579,7 +583,7 @@ interface BigUint64Array {
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array<TArrayBuffer>) => U, initialValue: U): U;
/** Reverses the elements in the array. */
reverse(): this;
@@ -596,7 +600,7 @@ interface BigUint64Array {
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice(start?: number, end?: number): BigUint64Array;
slice(start?: number, end?: number): BigUint64Array<ArrayBuffer>;
/**
* Determines whether the specified callback function returns true for any element of an array.
@@ -606,7 +610,7 @@ interface BigUint64Array {
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
some(predicate: (value: bigint, index: number, array: BigUint64Array<TArrayBuffer>) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
@@ -620,7 +624,7 @@ interface BigUint64Array {
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin?: number, end?: number): BigUint64Array;
subarray(begin?: number, end?: number): BigUint64Array<TArrayBuffer>;
/** Converts the array to a string by using the current locale. */
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
@@ -629,7 +633,7 @@ interface BigUint64Array {
toString(): string;
/** Returns the primitive value of the specified object. */
valueOf(): BigUint64Array;
valueOf(): BigUint64Array<TArrayBuffer>;
/** Yields each value in the array. */
values(): ArrayIterator<bigint>;
@@ -640,12 +644,11 @@ interface BigUint64Array {
[index: number]: bigint;
}
interface BigUint64ArrayConstructor {
readonly prototype: BigUint64Array;
new (length?: number): BigUint64Array;
new (array: Iterable<bigint>): BigUint64Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array;
readonly prototype: BigUint64Array<ArrayBufferLike>;
new (length?: number): BigUint64Array<ArrayBuffer>;
new (array: ArrayLike<bigint> | Iterable<bigint>): BigUint64Array<ArrayBuffer>;
new <TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(buffer: TArrayBuffer, byteOffset?: number, length?: number): BigUint64Array<TArrayBuffer>;
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
@@ -654,7 +657,7 @@ interface BigUint64ArrayConstructor {
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of(...items: bigint[]): BigUint64Array;
of(...items: bigint[]): BigUint64Array<ArrayBuffer>;
/**
* Creates an array from an array-like or iterable object.
@@ -665,10 +668,9 @@ interface BigUint64ArrayConstructor {
from(arrayLike: ArrayLike<bigint>): BigUint64Array;
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array;
}
declare var BigUint64Array: BigUint64ArrayConstructor;
interface DataView {
interface DataView<TArrayBuffer extends ArrayBufferLike> {
/**
* Gets the BigInt64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.

View File

@@ -4,54 +4,54 @@ interface Atomics {
* Until this atomic operation completes, any other read or write operation against the array
* will block.
*/
add(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
add(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Stores the bitwise AND of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or
* write operation against the array will block.
*/
and(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
and(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Replaces the value at the given position in the array if the original value equals the given
* expected value, returning the original value. Until this atomic operation completes, any
* other read or write operation against the array will block.
*/
compareExchange(typedArray: BigInt64Array | BigUint64Array, index: number, expectedValue: bigint, replacementValue: bigint): bigint;
compareExchange(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, expectedValue: bigint, replacementValue: bigint): bigint;
/**
* Replaces the value at the given position in the array, returning the original value. Until
* this atomic operation completes, any other read or write operation against the array will
* block.
*/
exchange(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
exchange(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Returns the value at the given position in the array. Until this atomic operation completes,
* any other read or write operation against the array will block.
*/
load(typedArray: BigInt64Array | BigUint64Array, index: number): bigint;
load(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number): bigint;
/**
* Stores the bitwise OR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
or(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
or(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Stores a value at the given position in the array, returning the new value. Until this
* atomic operation completes, any other read or write operation against the array will block.
*/
store(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
store(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Subtracts a value from the value at the given position in the array, returning the original
* value. Until this atomic operation completes, any other read or write operation against the
* array will block.
*/
sub(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
sub(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* If the value at the given position in the array is equal to the provided value, the current
@@ -59,7 +59,7 @@ interface Atomics {
* `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns
* `"not-equal"`.
*/
wait(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out";
wait(typedArray: BigInt64Array<ArrayBufferLike>, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out";
/**
* Wakes up sleeping agents that are waiting on the given index of the array, returning the
@@ -68,12 +68,12 @@ interface Atomics {
* @param index The position in the typedArray to wake up on.
* @param count The number of sleeping agents to notify. Defaults to +Infinity.
*/
notify(typedArray: BigInt64Array, index: number, count?: number): number;
notify(typedArray: BigInt64Array<ArrayBufferLike>, index: number, count?: number): number;
/**
* Stores the bitwise XOR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
xor(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
xor(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
}

View File

@@ -14,7 +14,7 @@ interface ReadonlyArray<T> {
at(index: number): T | undefined;
}
interface Int8Array {
interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -22,7 +22,7 @@ interface Int8Array {
at(index: number): number | undefined;
}
interface Uint8Array {
interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -30,7 +30,7 @@ interface Uint8Array {
at(index: number): number | undefined;
}
interface Uint8ClampedArray {
interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -38,7 +38,7 @@ interface Uint8ClampedArray {
at(index: number): number | undefined;
}
interface Int16Array {
interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -46,7 +46,7 @@ interface Int16Array {
at(index: number): number | undefined;
}
interface Uint16Array {
interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -54,7 +54,7 @@ interface Uint16Array {
at(index: number): number | undefined;
}
interface Int32Array {
interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -62,7 +62,7 @@ interface Int32Array {
at(index: number): number | undefined;
}
interface Uint32Array {
interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -70,7 +70,7 @@ interface Uint32Array {
at(index: number): number | undefined;
}
interface Float32Array {
interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -78,7 +78,7 @@ interface Float32Array {
at(index: number): number | undefined;
}
interface Float64Array {
interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -86,7 +86,7 @@ interface Float64Array {
at(index: number): number | undefined;
}
interface BigInt64Array {
interface BigInt64Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@@ -94,7 +94,7 @@ interface BigInt64Array {
at(index: number): bigint | undefined;
}
interface BigUint64Array {
interface BigUint64Array<TArrayBuffer extends ArrayBufferLike> {
/**
* Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.

View File

@@ -145,7 +145,7 @@ interface ReadonlyArray<T> {
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.
@@ -159,12 +159,12 @@ interface Int8Array {
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;
@@ -178,14 +178,14 @@ interface Int8Array {
* 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(): Int8Array;
toReversed(): Int8Array<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -193,11 +193,11 @@ interface Int8Array {
* 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 = Int8Array.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
* const myNums = Int8Array<Buffer>.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Int8Array<Buffer>(4) [1, 2, 11, 22]
* ```
*/
toSorted(compareFn?: (a: number, b: number) => number): Int8Array;
toSorted(compareFn?: (a: number, b: number) => number): Int8Array<ArrayBuffer>;
/**
* Copies the array and inserts the given number at the provided index.
@@ -206,10 +206,10 @@ interface Int8Array {
* @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): Int8Array;
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.
@@ -223,12 +223,12 @@ interface Uint8Array {
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;
@@ -242,14 +242,14 @@ interface Uint8Array {
* 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.
@@ -257,11 +257,11 @@ interface Uint8Array {
* 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 = Uint8Array<Buffer>.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint8Array<Buffer>(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.
@@ -270,10 +270,10 @@ interface Uint8Array {
* @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.
@@ -287,7 +287,7 @@ interface Uint8ClampedArray {
predicate: (
value: number,
index: number,
array: Uint8ClampedArray,
array: this,
) => value is S,
thisArg?: any,
): S | undefined;
@@ -295,7 +295,7 @@ interface Uint8ClampedArray {
predicate: (
value: number,
index: number,
array: Uint8ClampedArray,
array: this,
) => unknown,
thisArg?: any,
): number | undefined;
@@ -313,7 +313,7 @@ interface Uint8ClampedArray {
predicate: (
value: number,
index: number,
array: Uint8ClampedArray,
array: this,
) => unknown,
thisArg?: any,
): number;
@@ -321,7 +321,7 @@ interface Uint8ClampedArray {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): Uint8ClampedArray;
toReversed(): Uint8ClampedArray<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -329,11 +329,11 @@ interface Uint8ClampedArray {
* 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 = Uint8ClampedArray.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint8ClampedArray(4) [1, 2, 11, 22]
* const myNums = Uint8ClampedArray<Buffer>.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint8ClampedArray<Buffer>(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.
@@ -342,10 +342,10 @@ interface Uint8ClampedArray {
* @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.
@@ -359,12 +359,12 @@ interface Int16Array {
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;
@@ -378,14 +378,14 @@ interface Int16Array {
* 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.
@@ -393,11 +393,11 @@ interface Int16Array {
* 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 = Int16Array.from([11, 2, -22, 1]);
* myNums.toSorted((a, b) => a - b) // Int16Array(4) [-22, 1, 2, 11]
* const myNums = Int16Array<Buffer>.from([11, 2, -22, 1]);
* myNums.toSorted((a, b) => a - b) // Int16Array<Buffer>(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.
@@ -406,10 +406,10 @@ interface Int16Array {
* @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.
@@ -423,7 +423,7 @@ interface Uint16Array {
predicate: (
value: number,
index: number,
array: Uint16Array,
array: this,
) => value is S,
thisArg?: any,
): S | undefined;
@@ -431,7 +431,7 @@ interface Uint16Array {
predicate: (
value: number,
index: number,
array: Uint16Array,
array: this,
) => unknown,
thisArg?: any,
): number | undefined;
@@ -449,7 +449,7 @@ interface Uint16Array {
predicate: (
value: number,
index: number,
array: Uint16Array,
array: this,
) => unknown,
thisArg?: any,
): number;
@@ -457,7 +457,7 @@ interface Uint16Array {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): Uint16Array;
toReversed(): Uint16Array<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -465,11 +465,11 @@ interface Uint16Array {
* 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 = Uint16Array.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint16Array(4) [1, 2, 11, 22]
* const myNums = Uint16Array<Buffer>.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint16Array<Buffer>(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.
@@ -478,10 +478,10 @@ interface Uint16Array {
* @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.
@@ -495,12 +495,12 @@ interface Int32Array {
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;
@@ -514,14 +514,14 @@ interface Int32Array {
* 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.
@@ -529,11 +529,11 @@ interface Int32Array {
* 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 = Int32Array.from([11, 2, -22, 1]);
* myNums.toSorted((a, b) => a - b) // Int32Array(4) [-22, 1, 2, 11]
* const myNums = Int32Array<Buffer>.from([11, 2, -22, 1]);
* myNums.toSorted((a, b) => a - b) // Int32Array<Buffer>(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.
@@ -542,10 +542,10 @@ interface Int32Array {
* @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.
@@ -559,7 +559,7 @@ interface Uint32Array {
predicate: (
value: number,
index: number,
array: Uint32Array,
array: this,
) => value is S,
thisArg?: any,
): S | undefined;
@@ -567,7 +567,7 @@ interface Uint32Array {
predicate: (
value: number,
index: number,
array: Uint32Array,
array: this,
) => unknown,
thisArg?: any,
): number | undefined;
@@ -585,7 +585,7 @@ interface Uint32Array {
predicate: (
value: number,
index: number,
array: Uint32Array,
array: this,
) => unknown,
thisArg?: any,
): number;
@@ -593,7 +593,7 @@ interface Uint32Array {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): Uint32Array;
toReversed(): Uint32Array<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -601,11 +601,11 @@ interface Uint32Array {
* 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 = Uint32Array.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint32Array(4) [1, 2, 11, 22]
* const myNums = Uint32Array<Buffer>.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint32Array<Buffer>(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.
@@ -614,10 +614,10 @@ interface Uint32Array {
* @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.
@@ -631,7 +631,7 @@ interface Float32Array {
predicate: (
value: number,
index: number,
array: Float32Array,
array: this,
) => value is S,
thisArg?: any,
): S | undefined;
@@ -639,7 +639,7 @@ interface Float32Array {
predicate: (
value: number,
index: number,
array: Float32Array,
array: this,
) => unknown,
thisArg?: any,
): number | undefined;
@@ -657,7 +657,7 @@ interface Float32Array {
predicate: (
value: number,
index: number,
array: Float32Array,
array: this,
) => unknown,
thisArg?: any,
): number;
@@ -665,7 +665,7 @@ interface Float32Array {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): Float32Array;
toReversed(): Float32Array<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -673,11 +673,11 @@ interface Float32Array {
* 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 = Float32Array.from([11.25, 2, -22.5, 1]);
* myNums.toSorted((a, b) => a - b) // Float32Array(4) [-22.5, 1, 2, 11.5]
* const myNums = Float32Array<Buffer>.from([11.25, 2, -22.5, 1]);
* myNums.toSorted((a, b) => a - b) // Float32Array<Buffer>(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.
@@ -686,10 +686,10 @@ interface Float32Array {
* @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.
@@ -703,7 +703,7 @@ interface Float64Array {
predicate: (
value: number,
index: number,
array: Float64Array,
array: this,
) => value is S,
thisArg?: any,
): S | undefined;
@@ -711,7 +711,7 @@ interface Float64Array {
predicate: (
value: number,
index: number,
array: Float64Array,
array: this,
) => unknown,
thisArg?: any,
): number | undefined;
@@ -729,7 +729,7 @@ interface Float64Array {
predicate: (
value: number,
index: number,
array: Float64Array,
array: this,
) => unknown,
thisArg?: any,
): number;
@@ -737,7 +737,7 @@ interface Float64Array {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): Float64Array;
toReversed(): Float64Array<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -745,11 +745,11 @@ interface Float64Array {
* 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 = Float64Array.from([11.25, 2, -22.5, 1]);
* myNums.toSorted((a, b) => a - b) // Float64Array(4) [-22.5, 1, 2, 11.5]
* const myNums = Float64Array<Buffer>.from([11.25, 2, -22.5, 1]);
* myNums.toSorted((a, b) => a - b) // Float64Array<Buffer>(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.
@@ -758,10 +758,10 @@ interface Float64Array {
* @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.
@@ -775,7 +775,7 @@ interface BigInt64Array {
predicate: (
value: bigint,
index: number,
array: BigInt64Array,
array: this,
) => value is S,
thisArg?: any,
): S | undefined;
@@ -783,7 +783,7 @@ interface BigInt64Array {
predicate: (
value: bigint,
index: number,
array: BigInt64Array,
array: this,
) => unknown,
thisArg?: any,
): bigint | undefined;
@@ -801,7 +801,7 @@ interface BigInt64Array {
predicate: (
value: bigint,
index: number,
array: BigInt64Array,
array: this,
) => unknown,
thisArg?: any,
): number;
@@ -809,7 +809,7 @@ interface BigInt64Array {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): BigInt64Array;
toReversed(): BigInt64Array<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -817,11 +817,11 @@ interface BigInt64Array {
* 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 = BigInt64Array.from([11n, 2n, -22n, 1n]);
* myNums.toSorted((a, b) => Number(a - b)) // BigInt64Array(4) [-22n, 1n, 2n, 11n]
* const myNums = BigInt64Array<Buffer>.from([11n, 2n, -22n, 1n]);
* myNums.toSorted((a, b) => Number(a - b)) // BigInt64Array<Buffer>(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.
@@ -830,10 +830,10 @@ interface BigInt64Array {
* @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.
@@ -847,7 +847,7 @@ interface BigUint64Array {
predicate: (
value: bigint,
index: number,
array: BigUint64Array,
array: this,
) => value is S,
thisArg?: any,
): S | undefined;
@@ -855,7 +855,7 @@ interface BigUint64Array {
predicate: (
value: bigint,
index: number,
array: BigUint64Array,
array: this,
) => unknown,
thisArg?: any,
): bigint | undefined;
@@ -873,7 +873,7 @@ interface BigUint64Array {
predicate: (
value: bigint,
index: number,
array: BigUint64Array,
array: this,
) => unknown,
thisArg?: any,
): number;
@@ -881,7 +881,7 @@ interface BigUint64Array {
/**
* Copies the array and returns the copy with the elements in reverse order.
*/
toReversed(): BigUint64Array;
toReversed(): BigUint64Array<ArrayBuffer>;
/**
* Copies and sorts the array.
@@ -889,11 +889,11 @@ interface BigUint64Array {
* 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 = BigUint64Array.from([11n, 2n, 22n, 1n]);
* myNums.toSorted((a, b) => Number(a - b)) // BigUint64Array(4) [1n, 2n, 11n, 22n]
* const myNums = BigUint64Array<Buffer>.from([11n, 2n, 22n, 1n]);
* myNums.toSorted((a, b) => Number(a - b)) // BigUint64Array<Buffer>(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.
@@ -902,5 +902,5 @@ interface BigUint64Array {
* @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>;
}

502
src/lib/es5.d.ts vendored

File diff suppressed because it is too large Load Diff