Skip to content

In 5.7 beta, BigInt64ArrayConstructor mismatches with other typed arrays #60367

@trevorade

Description

@trevorade

🔎 Search Terms

"BigInt64Array", "typed array"

🕗 Version & Regression Information

  • This changed between versions 5.6.3 and 5.7.0-beta

⏯ Playground Link

https://www.typescriptlang.org/play/?target=11&ts=5.7.0-beta#code/PTAEGEFcCdoUwHYBdQDoAmqkGdQDc5psBLAewQCgKkBPABzlABV650BBWAQxvHOyTRIAYySlooALwVQs0CGbQaoYaQC2axEmIIA5qHKMuCdKCQALRGcsGLhAwDNrcbHFTMbAIzgAbUgHdQQmhxUF1SF1Aufx5UGTkAH1AAMT8uJAA2ABZOaB4+BAEhUXF42SSAIWJdAElkbNz8-kERMWgqOAAPOnEUB0gEUTIEUDUuAGs4FgYObhoACk9IBwdCAC5QRpoK5dXoABoVQQ3pti2CotbxAEpQAG94+CQYEYQ4QNFoRd3Ca4BuCgAXyoVAUAFlSOhiA5iFxPD5GAQiMMzKRQNhzAFhFxXKAetgSPDGDDOlRaAxQGCaKdZnleM1im0pGVQEkqalSOkGnMLi0Su05KzKdtqnVMjkeQyru0KF0etA+gMhuRRhM4FSaVtvit1ps5jsdQcjtANhrWLSmoU+W1bg9ZE8XqA3h9BNq9v8gVQdEhCA4uMJGFSqrV6hK6bzGaE7XJ4Fx0OQfMo6CExOS4KaRSHxVsADxbA17AAyxEmAD4ASyFFBYFozPQdLpcPNVBpaxZiLhSJAkNcWc7QPMEXoLAB+DYISBqbzQa4Z4Ni7l0vP6n7QctUQUKADKkF0uhcPtMkDo6HSbDrdAbuAs6VA8GwpB8BGvNjhpAIoCW+nmSvUmmQzi4j4OguL2m5gP28yzsK86hrm+aruu4FOu8A5DroFjjpO07QUGopwXMy50gWhDrn2qHzFwcwbFsxaTDmnjVN6pZCjUPp5ESDFMcgpa4ZmC5hjwRE8CRa4AoK-Y5kwCGGkEnQ+iYuAyUWJaMJIerEYhbq6tJK6Gocng0D6ADyKyuEgY5OthhCHOho5YVOvxzvh2aEbpmmGuuwLer6-qBvxBFLu5ImrnJCnoEpekqZMUgaSFhp0XALHRrIADaOjoF0DnTgAuhsjG6N6ALAhQPnQH6AbChyXKCfSVqRhIKV3nAcYJkmKakGmGbVa5S7KYQiVIXICgACJwDCbymDoQTYAATAADAAjAA7Fg5pUXSL5dro5igDowg+JAmWmJY8CgA4oSqAgBAIMQiABnEEkUXxPWLkJ-VieRgSDogGHmNlTlVWkvXvVFpHiXIkEbTwNFzIlOYTo5a4vcDb00MJ2yIRDsiScFmOyV04WRR50VqXF+N7KW2kmswH0GUZcCmQ45mWYj062b99lWUjKOciD6N46JQ04xR0M0LDdLw2zpFCh9vM1fBYOfd5yC+ZV7Ko7VUkfWFiAReTomJbFH2DfcLLpSYWXc7lAPQMVFBAA

💻 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

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions