optional parameter

This commit is contained in:
Kagami Sascha Rosylight 2021-10-27 00:54:54 +02:00
parent c341cd71ff
commit e67d6e5f60
13 changed files with 646 additions and 67 deletions

View file

@ -3,7 +3,7 @@ interface Array<T> {
* 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): T;
at(index?: number): T;
}
interface ReadonlyArray<T> {
@ -11,7 +11,7 @@ interface ReadonlyArray<T> {
* 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): T;
at(index?: number): T;
}
interface Int8Array {
@ -19,7 +19,7 @@ interface Int8Array {
* 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;
at(index?: number): number;
}
interface Uint8Array {
@ -27,7 +27,7 @@ interface Uint8Array {
* 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;
at(index?: number): number;
}
interface Uint8ClampedArray {
@ -35,7 +35,7 @@ interface Uint8ClampedArray {
* 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;
at(index?: number): number;
}
interface Int16Array {
@ -43,7 +43,7 @@ interface Int16Array {
* 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;
at(index?: number): number;
}
interface Uint16Array {
@ -51,7 +51,7 @@ interface Uint16Array {
* 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;
at(index?: number): number;
}
interface Int32Array {
@ -59,7 +59,7 @@ interface Int32Array {
* 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;
at(index?: number): number;
}
interface Uint32Array {
@ -67,7 +67,7 @@ interface Uint32Array {
* 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;
at(index?: number): number;
}
interface Float32Array {
@ -75,7 +75,7 @@ interface Float32Array {
* 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;
at(index?: number): number;
}
interface Float64Array {
@ -83,7 +83,7 @@ interface Float64Array {
* 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;
at(index?: number): number;
}
interface BigInt64Array {
@ -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;
at(index?: number): number;
}
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;
at(index?: number): number;
}

View file

@ -3,5 +3,5 @@ interface String {
* Returns a new String consisting of the single UTF-16 code unit 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): string;
at(index?: number): string;
}

View file

@ -11,9 +11,22 @@ tests/cases/compiler/indexAt.ts(10,20): error TS2550: Property 'at' does not exi
tests/cases/compiler/indexAt.ts(11,20): error TS2550: Property 'at' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(12,21): error TS2550: Property 'at' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(13,22): error TS2550: Property 'at' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(15,5): error TS2550: Property 'at' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(16,7): error TS2550: Property 'at' does not exist on type '"foo"'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(17,17): error TS2550: Property 'at' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(18,18): error TS2550: Property 'at' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(19,25): error TS2550: Property 'at' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(20,18): error TS2550: Property 'at' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(21,19): error TS2550: Property 'at' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(22,18): error TS2550: Property 'at' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(23,19): error TS2550: Property 'at' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(24,20): error TS2550: Property 'at' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(25,20): error TS2550: Property 'at' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(26,21): error TS2550: Property 'at' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
tests/cases/compiler/indexAt.ts(27,22): error TS2550: Property 'at' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
==== tests/cases/compiler/indexAt.ts (13 errors) ====
==== tests/cases/compiler/indexAt.ts (26 errors) ====
[0].at(0);
~~
!!! error TS2550: Property 'at' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
@ -53,4 +66,44 @@ tests/cases/compiler/indexAt.ts(13,22): error TS2550: Property 'at' does not exi
new BigUint64Array().at(0);
~~
!!! error TS2550: Property 'at' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
[0].at();
~~
!!! error TS2550: Property 'at' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
"foo".at();
~~
!!! error TS2550: Property 'at' does not exist on type '"foo"'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Int8Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Uint8Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Uint8ClampedArray().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Int16Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Uint16Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Int32Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Uint32Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Float32Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new Float64Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new BigInt64Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.
new BigUint64Array().at();
~~
!!! error TS2550: Property 'at' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later.

View file

@ -12,6 +12,20 @@ new Float32Array().at(0);
new Float64Array().at(0);
new BigInt64Array().at(0);
new BigUint64Array().at(0);
[0].at();
"foo".at();
new Int8Array().at();
new Uint8Array().at();
new Uint8ClampedArray().at();
new Int16Array().at();
new Uint16Array().at();
new Int32Array().at();
new Uint32Array().at();
new Float32Array().at();
new Float64Array().at();
new BigInt64Array().at();
new BigUint64Array().at();
//// [indexAt.js]
@ -28,3 +42,16 @@ new Float32Array().at(0);
new Float64Array().at(0);
new BigInt64Array().at(0);
new BigUint64Array().at(0);
[0].at();
"foo".at();
new Int8Array().at();
new Uint8Array().at();
new Uint8ClampedArray().at();
new Int16Array().at();
new Uint16Array().at();
new Int32Array().at();
new Uint32Array().at();
new Float32Array().at();
new Float64Array().at();
new BigInt64Array().at();
new BigUint64Array().at();

View file

@ -34,3 +34,38 @@ new BigInt64Array().at(0);
new BigUint64Array().at(0);
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
[0].at();
"foo".at();
new Int8Array().at();
>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Uint8Array().at();
>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Uint8ClampedArray().at();
>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Int16Array().at();
>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Uint16Array().at();
>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Int32Array().at();
>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Uint32Array().at();
>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Float32Array().at();
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new Float64Array().at();
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --))
new BigInt64Array().at();
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
new BigUint64Array().at();
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))

View file

@ -102,3 +102,93 @@ new BigUint64Array().at(0);
>at : any
>0 : 0
[0].at();
>[0].at() : any
>[0].at : any
>[0] : number[]
>0 : 0
>at : any
"foo".at();
>"foo".at() : any
>"foo".at : any
>"foo" : "foo"
>at : any
new Int8Array().at();
>new Int8Array().at() : any
>new Int8Array().at : any
>new Int8Array() : Int8Array
>Int8Array : Int8ArrayConstructor
>at : any
new Uint8Array().at();
>new Uint8Array().at() : any
>new Uint8Array().at : any
>new Uint8Array() : Uint8Array
>Uint8Array : Uint8ArrayConstructor
>at : any
new Uint8ClampedArray().at();
>new Uint8ClampedArray().at() : any
>new Uint8ClampedArray().at : any
>new Uint8ClampedArray() : Uint8ClampedArray
>Uint8ClampedArray : Uint8ClampedArrayConstructor
>at : any
new Int16Array().at();
>new Int16Array().at() : any
>new Int16Array().at : any
>new Int16Array() : Int16Array
>Int16Array : Int16ArrayConstructor
>at : any
new Uint16Array().at();
>new Uint16Array().at() : any
>new Uint16Array().at : any
>new Uint16Array() : Uint16Array
>Uint16Array : Uint16ArrayConstructor
>at : any
new Int32Array().at();
>new Int32Array().at() : any
>new Int32Array().at : any
>new Int32Array() : Int32Array
>Int32Array : Int32ArrayConstructor
>at : any
new Uint32Array().at();
>new Uint32Array().at() : any
>new Uint32Array().at : any
>new Uint32Array() : Uint32Array
>Uint32Array : Uint32ArrayConstructor
>at : any
new Float32Array().at();
>new Float32Array().at() : any
>new Float32Array().at : any
>new Float32Array() : Float32Array
>Float32Array : Float32ArrayConstructor
>at : any
new Float64Array().at();
>new Float64Array().at() : any
>new Float64Array().at : any
>new Float64Array() : Float64Array
>Float64Array : Float64ArrayConstructor
>at : any
new BigInt64Array().at();
>new BigInt64Array().at() : any
>new BigInt64Array().at : any
>new BigInt64Array() : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>at : any
new BigUint64Array().at();
>new BigUint64Array().at() : any
>new BigUint64Array().at : any
>new BigUint64Array() : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>at : any

View file

@ -12,6 +12,20 @@ new Float32Array().at(0);
new Float64Array().at(0);
new BigInt64Array().at(0);
new BigUint64Array().at(0);
[0].at();
"foo".at();
new Int8Array().at();
new Uint8Array().at();
new Uint8ClampedArray().at();
new Int16Array().at();
new Uint16Array().at();
new Int32Array().at();
new Uint32Array().at();
new Float32Array().at();
new Float64Array().at();
new BigInt64Array().at();
new BigUint64Array().at();
//// [indexAt.js]
@ -28,3 +42,16 @@ new Float32Array().at(0);
new Float64Array().at(0);
new BigInt64Array().at(0);
new BigUint64Array().at(0);
[0].at();
"foo".at();
new Int8Array().at();
new Uint8Array().at();
new Uint8ClampedArray().at();
new Int16Array().at();
new Uint16Array().at();
new Int32Array().at();
new Uint32Array().at();
new Float32Array().at();
new Float64Array().at();
new BigInt64Array().at();
new BigUint64Array().at();

View file

@ -62,3 +62,66 @@ new BigUint64Array().at(0);
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --))
[0].at();
>[0].at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --))
"foo".at();
>"foo".at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --))
>at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --))
new Int8Array().at();
>new Int8Array().at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint8Array().at();
>new Uint8Array().at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint8ClampedArray().at();
>new Uint8ClampedArray().at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --))
new Int16Array().at();
>new Int16Array().at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint16Array().at();
>new Uint16Array().at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Int32Array().at();
>new Int32Array().at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint32Array().at();
>new Uint32Array().at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Float32Array().at();
>new Float32Array().at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Float64Array().at();
>new Float64Array().at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --))
new BigInt64Array().at();
>new BigInt64Array().at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --))
new BigUint64Array().at();
>new BigUint64Array().at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --))

View file

@ -1,104 +1,194 @@
=== tests/cases/compiler/indexAt.ts ===
[0].at(0);
>[0].at(0) : number
>[0].at : (index: number) => number
>[0].at : (index?: number) => number
>[0] : number[]
>0 : 0
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
"foo".at(0);
>"foo".at(0) : string
>"foo".at : (index: number) => string
>"foo".at : (index?: number) => string
>"foo" : "foo"
>at : (index: number) => string
>at : (index?: number) => string
>0 : 0
new Int8Array().at(0);
>new Int8Array().at(0) : number
>new Int8Array().at : (index: number) => number
>new Int8Array().at : (index?: number) => number
>new Int8Array() : Int8Array
>Int8Array : Int8ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint8Array().at(0);
>new Uint8Array().at(0) : number
>new Uint8Array().at : (index: number) => number
>new Uint8Array().at : (index?: number) => number
>new Uint8Array() : Uint8Array
>Uint8Array : Uint8ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint8ClampedArray().at(0);
>new Uint8ClampedArray().at(0) : number
>new Uint8ClampedArray().at : (index: number) => number
>new Uint8ClampedArray().at : (index?: number) => number
>new Uint8ClampedArray() : Uint8ClampedArray
>Uint8ClampedArray : Uint8ClampedArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Int16Array().at(0);
>new Int16Array().at(0) : number
>new Int16Array().at : (index: number) => number
>new Int16Array().at : (index?: number) => number
>new Int16Array() : Int16Array
>Int16Array : Int16ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint16Array().at(0);
>new Uint16Array().at(0) : number
>new Uint16Array().at : (index: number) => number
>new Uint16Array().at : (index?: number) => number
>new Uint16Array() : Uint16Array
>Uint16Array : Uint16ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Int32Array().at(0);
>new Int32Array().at(0) : number
>new Int32Array().at : (index: number) => number
>new Int32Array().at : (index?: number) => number
>new Int32Array() : Int32Array
>Int32Array : Int32ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint32Array().at(0);
>new Uint32Array().at(0) : number
>new Uint32Array().at : (index: number) => number
>new Uint32Array().at : (index?: number) => number
>new Uint32Array() : Uint32Array
>Uint32Array : Uint32ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Float32Array().at(0);
>new Float32Array().at(0) : number
>new Float32Array().at : (index: number) => number
>new Float32Array().at : (index?: number) => number
>new Float32Array() : Float32Array
>Float32Array : Float32ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Float64Array().at(0);
>new Float64Array().at(0) : number
>new Float64Array().at : (index: number) => number
>new Float64Array().at : (index?: number) => number
>new Float64Array() : Float64Array
>Float64Array : Float64ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new BigInt64Array().at(0);
>new BigInt64Array().at(0) : number
>new BigInt64Array().at : (index: number) => number
>new BigInt64Array().at : (index?: number) => number
>new BigInt64Array() : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new BigUint64Array().at(0);
>new BigUint64Array().at(0) : number
>new BigUint64Array().at : (index: number) => number
>new BigUint64Array().at : (index?: number) => number
>new BigUint64Array() : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
[0].at();
>[0].at() : number
>[0].at : (index?: number) => number
>[0] : number[]
>0 : 0
>at : (index?: number) => number
"foo".at();
>"foo".at() : string
>"foo".at : (index?: number) => string
>"foo" : "foo"
>at : (index?: number) => string
new Int8Array().at();
>new Int8Array().at() : number
>new Int8Array().at : (index?: number) => number
>new Int8Array() : Int8Array
>Int8Array : Int8ArrayConstructor
>at : (index?: number) => number
new Uint8Array().at();
>new Uint8Array().at() : number
>new Uint8Array().at : (index?: number) => number
>new Uint8Array() : Uint8Array
>Uint8Array : Uint8ArrayConstructor
>at : (index?: number) => number
new Uint8ClampedArray().at();
>new Uint8ClampedArray().at() : number
>new Uint8ClampedArray().at : (index?: number) => number
>new Uint8ClampedArray() : Uint8ClampedArray
>Uint8ClampedArray : Uint8ClampedArrayConstructor
>at : (index?: number) => number
new Int16Array().at();
>new Int16Array().at() : number
>new Int16Array().at : (index?: number) => number
>new Int16Array() : Int16Array
>Int16Array : Int16ArrayConstructor
>at : (index?: number) => number
new Uint16Array().at();
>new Uint16Array().at() : number
>new Uint16Array().at : (index?: number) => number
>new Uint16Array() : Uint16Array
>Uint16Array : Uint16ArrayConstructor
>at : (index?: number) => number
new Int32Array().at();
>new Int32Array().at() : number
>new Int32Array().at : (index?: number) => number
>new Int32Array() : Int32Array
>Int32Array : Int32ArrayConstructor
>at : (index?: number) => number
new Uint32Array().at();
>new Uint32Array().at() : number
>new Uint32Array().at : (index?: number) => number
>new Uint32Array() : Uint32Array
>Uint32Array : Uint32ArrayConstructor
>at : (index?: number) => number
new Float32Array().at();
>new Float32Array().at() : number
>new Float32Array().at : (index?: number) => number
>new Float32Array() : Float32Array
>Float32Array : Float32ArrayConstructor
>at : (index?: number) => number
new Float64Array().at();
>new Float64Array().at() : number
>new Float64Array().at : (index?: number) => number
>new Float64Array() : Float64Array
>Float64Array : Float64ArrayConstructor
>at : (index?: number) => number
new BigInt64Array().at();
>new BigInt64Array().at() : number
>new BigInt64Array().at : (index?: number) => number
>new BigInt64Array() : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>at : (index?: number) => number
new BigUint64Array().at();
>new BigUint64Array().at() : number
>new BigUint64Array().at : (index?: number) => number
>new BigUint64Array() : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>at : (index?: number) => number

View file

@ -12,6 +12,20 @@ new Float32Array().at(0);
new Float64Array().at(0);
new BigInt64Array().at(0);
new BigUint64Array().at(0);
[0].at();
"foo".at();
new Int8Array().at();
new Uint8Array().at();
new Uint8ClampedArray().at();
new Int16Array().at();
new Uint16Array().at();
new Int32Array().at();
new Uint32Array().at();
new Float32Array().at();
new Float64Array().at();
new BigInt64Array().at();
new BigUint64Array().at();
//// [indexAt.js]
@ -28,3 +42,16 @@ new Float32Array().at(0);
new Float64Array().at(0);
new BigInt64Array().at(0);
new BigUint64Array().at(0);
[0].at();
"foo".at();
new Int8Array().at();
new Uint8Array().at();
new Uint8ClampedArray().at();
new Int16Array().at();
new Uint16Array().at();
new Int32Array().at();
new Uint32Array().at();
new Float32Array().at();
new Float64Array().at();
new BigInt64Array().at();
new BigUint64Array().at();

View file

@ -62,3 +62,66 @@ new BigUint64Array().at(0);
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --))
[0].at();
>[0].at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --))
"foo".at();
>"foo".at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --))
>at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --))
new Int8Array().at();
>new Int8Array().at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint8Array().at();
>new Uint8Array().at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint8ClampedArray().at();
>new Uint8ClampedArray().at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --))
new Int16Array().at();
>new Int16Array().at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint16Array().at();
>new Uint16Array().at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Int32Array().at();
>new Int32Array().at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Uint32Array().at();
>new Uint32Array().at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Float32Array().at();
>new Float32Array().at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --))
new Float64Array().at();
>new Float64Array().at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --))
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more)
>at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --))
new BigInt64Array().at();
>new BigInt64Array().at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --))
new BigUint64Array().at();
>new BigUint64Array().at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --))
>at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --))

View file

@ -1,104 +1,194 @@
=== tests/cases/compiler/indexAt.ts ===
[0].at(0);
>[0].at(0) : number
>[0].at : (index: number) => number
>[0].at : (index?: number) => number
>[0] : number[]
>0 : 0
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
"foo".at(0);
>"foo".at(0) : string
>"foo".at : (index: number) => string
>"foo".at : (index?: number) => string
>"foo" : "foo"
>at : (index: number) => string
>at : (index?: number) => string
>0 : 0
new Int8Array().at(0);
>new Int8Array().at(0) : number
>new Int8Array().at : (index: number) => number
>new Int8Array().at : (index?: number) => number
>new Int8Array() : Int8Array
>Int8Array : Int8ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint8Array().at(0);
>new Uint8Array().at(0) : number
>new Uint8Array().at : (index: number) => number
>new Uint8Array().at : (index?: number) => number
>new Uint8Array() : Uint8Array
>Uint8Array : Uint8ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint8ClampedArray().at(0);
>new Uint8ClampedArray().at(0) : number
>new Uint8ClampedArray().at : (index: number) => number
>new Uint8ClampedArray().at : (index?: number) => number
>new Uint8ClampedArray() : Uint8ClampedArray
>Uint8ClampedArray : Uint8ClampedArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Int16Array().at(0);
>new Int16Array().at(0) : number
>new Int16Array().at : (index: number) => number
>new Int16Array().at : (index?: number) => number
>new Int16Array() : Int16Array
>Int16Array : Int16ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint16Array().at(0);
>new Uint16Array().at(0) : number
>new Uint16Array().at : (index: number) => number
>new Uint16Array().at : (index?: number) => number
>new Uint16Array() : Uint16Array
>Uint16Array : Uint16ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Int32Array().at(0);
>new Int32Array().at(0) : number
>new Int32Array().at : (index: number) => number
>new Int32Array().at : (index?: number) => number
>new Int32Array() : Int32Array
>Int32Array : Int32ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Uint32Array().at(0);
>new Uint32Array().at(0) : number
>new Uint32Array().at : (index: number) => number
>new Uint32Array().at : (index?: number) => number
>new Uint32Array() : Uint32Array
>Uint32Array : Uint32ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Float32Array().at(0);
>new Float32Array().at(0) : number
>new Float32Array().at : (index: number) => number
>new Float32Array().at : (index?: number) => number
>new Float32Array() : Float32Array
>Float32Array : Float32ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new Float64Array().at(0);
>new Float64Array().at(0) : number
>new Float64Array().at : (index: number) => number
>new Float64Array().at : (index?: number) => number
>new Float64Array() : Float64Array
>Float64Array : Float64ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new BigInt64Array().at(0);
>new BigInt64Array().at(0) : number
>new BigInt64Array().at : (index: number) => number
>new BigInt64Array().at : (index?: number) => number
>new BigInt64Array() : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
new BigUint64Array().at(0);
>new BigUint64Array().at(0) : number
>new BigUint64Array().at : (index: number) => number
>new BigUint64Array().at : (index?: number) => number
>new BigUint64Array() : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>at : (index: number) => number
>at : (index?: number) => number
>0 : 0
[0].at();
>[0].at() : number
>[0].at : (index?: number) => number
>[0] : number[]
>0 : 0
>at : (index?: number) => number
"foo".at();
>"foo".at() : string
>"foo".at : (index?: number) => string
>"foo" : "foo"
>at : (index?: number) => string
new Int8Array().at();
>new Int8Array().at() : number
>new Int8Array().at : (index?: number) => number
>new Int8Array() : Int8Array
>Int8Array : Int8ArrayConstructor
>at : (index?: number) => number
new Uint8Array().at();
>new Uint8Array().at() : number
>new Uint8Array().at : (index?: number) => number
>new Uint8Array() : Uint8Array
>Uint8Array : Uint8ArrayConstructor
>at : (index?: number) => number
new Uint8ClampedArray().at();
>new Uint8ClampedArray().at() : number
>new Uint8ClampedArray().at : (index?: number) => number
>new Uint8ClampedArray() : Uint8ClampedArray
>Uint8ClampedArray : Uint8ClampedArrayConstructor
>at : (index?: number) => number
new Int16Array().at();
>new Int16Array().at() : number
>new Int16Array().at : (index?: number) => number
>new Int16Array() : Int16Array
>Int16Array : Int16ArrayConstructor
>at : (index?: number) => number
new Uint16Array().at();
>new Uint16Array().at() : number
>new Uint16Array().at : (index?: number) => number
>new Uint16Array() : Uint16Array
>Uint16Array : Uint16ArrayConstructor
>at : (index?: number) => number
new Int32Array().at();
>new Int32Array().at() : number
>new Int32Array().at : (index?: number) => number
>new Int32Array() : Int32Array
>Int32Array : Int32ArrayConstructor
>at : (index?: number) => number
new Uint32Array().at();
>new Uint32Array().at() : number
>new Uint32Array().at : (index?: number) => number
>new Uint32Array() : Uint32Array
>Uint32Array : Uint32ArrayConstructor
>at : (index?: number) => number
new Float32Array().at();
>new Float32Array().at() : number
>new Float32Array().at : (index?: number) => number
>new Float32Array() : Float32Array
>Float32Array : Float32ArrayConstructor
>at : (index?: number) => number
new Float64Array().at();
>new Float64Array().at() : number
>new Float64Array().at : (index?: number) => number
>new Float64Array() : Float64Array
>Float64Array : Float64ArrayConstructor
>at : (index?: number) => number
new BigInt64Array().at();
>new BigInt64Array().at() : number
>new BigInt64Array().at : (index?: number) => number
>new BigInt64Array() : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>at : (index?: number) => number
new BigUint64Array().at();
>new BigUint64Array().at() : number
>new BigUint64Array().at : (index?: number) => number
>new BigUint64Array() : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>at : (index?: number) => number

View file

@ -13,3 +13,17 @@ new Float32Array().at(0);
new Float64Array().at(0);
new BigInt64Array().at(0);
new BigUint64Array().at(0);
[0].at();
"foo".at();
new Int8Array().at();
new Uint8Array().at();
new Uint8ClampedArray().at();
new Int16Array().at();
new Uint16Array().at();
new Int32Array().at();
new Uint32Array().at();
new Float32Array().at();
new Float64Array().at();
new BigInt64Array().at();
new BigUint64Array().at();