Closed
Description
π Search Terms
"BigInt64Array", "typed array"
π Version & Regression Information
- This changed between versions 5.6.3 and 5.7.0-beta
β― Playground Link
π» Code
type TypedArrayConstructor =
| Float64ArrayConstructor
| BigInt64ArrayConstructor
export function makeTypedArray(buffer: ArrayBuffer, ctr: TypedArrayConstructor) {
return new ctr(buffer); // Incorrect error here.
}
π Actual behavior
new ctr(buffer)
produces error:
No overload matches this call.
Overload 1 of 4, '(length: number): Float64Array<ArrayBuffer> | BigInt64Array<ArrayBuffer>', gave the following error.
Argument of type 'ArrayBuffer' is not assignable to parameter of type 'number'.
Overload 2 of 4, '(length?: number | undefined): Float64Array<ArrayBuffer> | BigInt64Array<ArrayBuffer>', gave the following error.
Argument of type 'ArrayBuffer' is not assignable to parameter of type 'number'.
Overload 3 of 4, '(array: ArrayLike<bigint> | Iterable<bigint>): Float64Array<ArrayBuffer> | BigInt64Array<ArrayBuffer>', gave the following error.
Argument of type 'ArrayBuffer' is not assignable to parameter of type 'ArrayLike<bigint> | Iterable<bigint>'.
π Expected behavior
Compiles without any error.
Additional information about the issue
Google code location where this reproduces: http://shortn/_EriWkk8A2g