Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/es2020.bigint.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ interface BigInt64ArrayConstructor {
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>;
new (array: ArrayLike<bigint> | ArrayBuffer): BigInt64Array<ArrayBuffer>;

/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
Expand Down Expand Up @@ -649,6 +650,7 @@ interface BigUint64ArrayConstructor {
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>;
new (array: ArrayLike<bigint> | ArrayBuffer): BigUint64Array<ArrayBuffer>;

/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
Expand Down
13 changes: 13 additions & 0 deletions tests/cases/compiler/typedArrayConstructorOverloads.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @target: esnext
// @noEmit: true
// @noTypesAndSymbols: true

// https://github.com/microsoft/TypeScript/issues/60367

type TypedArrayConstructor =
| Float64ArrayConstructor
| BigInt64ArrayConstructor

export function makeTypedArray(buffer: ArrayBuffer, ctr: TypedArrayConstructor) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: There is no output because this is only check for an error. Without the above changes to es2020.bigint.d.ts, an errors.txt is generated.

return new ctr(buffer);
}