From 1957fed15b80e6880a5e396859c40ea9de0fd421 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 8 Jan 2025 15:59:24 -0500 Subject: [PATCH] Add non-generic fallback overloads for TypedArray constructors --- src/lib/es2020.bigint.d.ts | 6 ++++-- src/lib/es5.d.ts | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index 05fbbf12ce146..5a258425418ed 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -373,6 +373,7 @@ interface BigInt64ArrayConstructor { new (length?: number): BigInt64Array; new (array: ArrayLike | Iterable): BigInt64Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): BigInt64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): BigInt64Array; new (array: ArrayLike | ArrayBuffer): BigInt64Array; /** The size in bytes of each element in the array. */ @@ -650,6 +651,7 @@ interface BigUint64ArrayConstructor { new (length?: number): BigUint64Array; new (array: ArrayLike | Iterable): BigUint64Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): BigUint64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): BigUint64Array; new (array: ArrayLike | ArrayBuffer): BigUint64Array; /** The size in bytes of each element in the array. */ @@ -667,8 +669,8 @@ interface BigUint64ArrayConstructor { * @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): BigUint64Array; - from(arrayLike: ArrayLike, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array; + from(arrayLike: ArrayLike): BigUint64Array; + from(arrayLike: ArrayLike, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array; } declare var BigUint64Array: BigUint64ArrayConstructor; diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 963f6ad24f1a7..4f724ddba4784 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -2104,6 +2104,7 @@ interface Int8ArrayConstructor { new (array: ArrayLike): Int8Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Int8Array; new (array: ArrayLike | ArrayBuffer): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** * The size in bytes of each element in the array. @@ -2385,6 +2386,7 @@ interface Uint8ArrayConstructor { new (array: ArrayLike): Uint8Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Uint8Array; new (array: ArrayLike | ArrayBuffer): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** * The size in bytes of each element in the array. @@ -2666,6 +2668,7 @@ interface Uint8ClampedArrayConstructor { new (array: ArrayLike): Uint8ClampedArray; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; new (array: ArrayLike | ArrayBuffer): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** * The size in bytes of each element in the array. @@ -2946,6 +2949,7 @@ interface Int16ArrayConstructor { new (array: ArrayLike): Int16Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Int16Array; new (array: ArrayLike | ArrayBuffer): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** * The size in bytes of each element in the array. @@ -3227,6 +3231,7 @@ interface Uint16ArrayConstructor { new (array: ArrayLike): Uint16Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Uint16Array; new (array: ArrayLike | ArrayBuffer): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** * The size in bytes of each element in the array. @@ -3507,6 +3512,7 @@ interface Int32ArrayConstructor { new (array: ArrayLike): Int32Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Int32Array; new (array: ArrayLike | ArrayBuffer): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** * The size in bytes of each element in the array. @@ -3787,6 +3793,7 @@ interface Uint32ArrayConstructor { new (array: ArrayLike): Uint32Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Uint32Array; new (array: ArrayLike | ArrayBuffer): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** * The size in bytes of each element in the array. @@ -4068,6 +4075,7 @@ interface Float32ArrayConstructor { new (array: ArrayLike): Float32Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Float32Array; new (array: ArrayLike | ArrayBuffer): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** * The size in bytes of each element in the array. @@ -4349,6 +4357,7 @@ interface Float64ArrayConstructor { new (array: ArrayLike): Float64Array; new (buffer: TArrayBuffer, byteOffset?: number, length?: number): Float64Array; new (array: ArrayLike | ArrayBuffer): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** * The size in bytes of each element in the array.