Skip to content

Commit

Permalink
Big[U]Int64Array.at returns bigint, not number (microsoft#46733)
Browse files Browse the repository at this point in the history
bigint is needed to represent all 64-bit ints that these arrays could
contain.
  • Loading branch information
sandersn authored Nov 8, 2021
1 parent 3ef3cdd commit 9713cc1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/lib/es2022.array.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ interface BigInt64Array {
* 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.
*/
at(index: number): number | undefined;
at(index: number): bigint | undefined;
}

interface BigUint64Array {
/**
* 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.
*/
at(index: number): number | undefined;
at(index: number): bigint | undefined;
}
12 changes: 6 additions & 6 deletions tests/baselines/reference/indexAt(target=es2022).types
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ new Float64Array().at(0);
>0 : 0

new BigInt64Array().at(0);
>new BigInt64Array().at(0) : number
>new BigInt64Array().at : (index: number) => number
>new BigInt64Array().at(0) : bigint
>new BigInt64Array().at : (index: number) => bigint
>new BigInt64Array() : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>at : (index: number) => number
>at : (index: number) => bigint
>0 : 0

new BigUint64Array().at(0);
>new BigUint64Array().at(0) : number
>new BigUint64Array().at : (index: number) => number
>new BigUint64Array().at(0) : bigint
>new BigUint64Array().at : (index: number) => bigint
>new BigUint64Array() : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>at : (index: number) => number
>at : (index: number) => bigint
>0 : 0

12 changes: 6 additions & 6 deletions tests/baselines/reference/indexAt(target=esnext).types
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ new Float64Array().at(0);
>0 : 0

new BigInt64Array().at(0);
>new BigInt64Array().at(0) : number
>new BigInt64Array().at : (index: number) => number
>new BigInt64Array().at(0) : bigint
>new BigInt64Array().at : (index: number) => bigint
>new BigInt64Array() : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>at : (index: number) => number
>at : (index: number) => bigint
>0 : 0

new BigUint64Array().at(0);
>new BigUint64Array().at(0) : number
>new BigUint64Array().at : (index: number) => number
>new BigUint64Array().at(0) : bigint
>new BigUint64Array().at : (index: number) => bigint
>new BigUint64Array() : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>at : (index: number) => number
>at : (index: number) => bigint
>0 : 0

0 comments on commit 9713cc1

Please sign in to comment.