Big[U]Int64Array.at returns bigint, not number (#46733)

bigint is needed to represent all 64-bit ints that these arrays could
contain.
This commit is contained in:
Nathan Shively-Sanders 2021-11-08 09:50:02 -08:00 committed by GitHub
parent 3ef3cdddb3
commit 9713cc1a75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View file

@ -91,7 +91,7 @@ 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 {
@ -99,5 +99,5 @@ 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;
}

View file

@ -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

View file

@ -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