Skip to content

Commit 9713cc1

Browse files
authored
Big[U]Int64Array.at returns bigint, not number (microsoft#46733)
bigint is needed to represent all 64-bit ints that these arrays could contain.
1 parent 3ef3cdd commit 9713cc1

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/lib/es2022.array.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ interface BigInt64Array {
9191
* Returns the item located at the specified index.
9292
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
9393
*/
94-
at(index: number): number | undefined;
94+
at(index: number): bigint | undefined;
9595
}
9696

9797
interface BigUint64Array {
9898
/**
9999
* Returns the item located at the specified index.
100100
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
101101
*/
102-
at(index: number): number | undefined;
102+
at(index: number): bigint | undefined;
103103
}

tests/baselines/reference/indexAt(target=es2022).types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,18 @@ new Float64Array().at(0);
8787
>0 : 0
8888

8989
new BigInt64Array().at(0);
90-
>new BigInt64Array().at(0) : number
91-
>new BigInt64Array().at : (index: number) => number
90+
>new BigInt64Array().at(0) : bigint
91+
>new BigInt64Array().at : (index: number) => bigint
9292
>new BigInt64Array() : BigInt64Array
9393
>BigInt64Array : BigInt64ArrayConstructor
94-
>at : (index: number) => number
94+
>at : (index: number) => bigint
9595
>0 : 0
9696

9797
new BigUint64Array().at(0);
98-
>new BigUint64Array().at(0) : number
99-
>new BigUint64Array().at : (index: number) => number
98+
>new BigUint64Array().at(0) : bigint
99+
>new BigUint64Array().at : (index: number) => bigint
100100
>new BigUint64Array() : BigUint64Array
101101
>BigUint64Array : BigUint64ArrayConstructor
102-
>at : (index: number) => number
102+
>at : (index: number) => bigint
103103
>0 : 0
104104

tests/baselines/reference/indexAt(target=esnext).types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,18 @@ new Float64Array().at(0);
8787
>0 : 0
8888

8989
new BigInt64Array().at(0);
90-
>new BigInt64Array().at(0) : number
91-
>new BigInt64Array().at : (index: number) => number
90+
>new BigInt64Array().at(0) : bigint
91+
>new BigInt64Array().at : (index: number) => bigint
9292
>new BigInt64Array() : BigInt64Array
9393
>BigInt64Array : BigInt64ArrayConstructor
94-
>at : (index: number) => number
94+
>at : (index: number) => bigint
9595
>0 : 0
9696

9797
new BigUint64Array().at(0);
98-
>new BigUint64Array().at(0) : number
99-
>new BigUint64Array().at : (index: number) => number
98+
>new BigUint64Array().at(0) : bigint
99+
>new BigUint64Array().at : (index: number) => bigint
100100
>new BigUint64Array() : BigUint64Array
101101
>BigUint64Array : BigUint64ArrayConstructor
102-
>at : (index: number) => number
102+
>at : (index: number) => bigint
103103
>0 : 0
104104

0 commit comments

Comments
 (0)