From 5b7da72b0d93bb9d24f757783db61198d92c9e9f Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 10 Oct 2021 13:24:53 +0200 Subject: [PATCH 1/9] Add `target: "es2022"` --- src/compiler/commandLineParser.ts | 8 +- src/compiler/types.ts | 21 ++-- src/compiler/utilities.ts | 15 +++ src/compiler/utilitiesPublic.ts | 2 + src/lib/es2022.array.d.ts | 103 +++++++++++++++++ src/lib/es2022.d.ts | 3 + src/lib/es2022.full.d.ts | 5 + src/lib/es2022.string.d.ts | 7 ++ src/lib/esnext.d.ts | 2 +- src/lib/libs.json | 4 + src/server/protocol.ts | 1 + .../unittests/config/commandLineParsing.ts | 2 +- .../reference/api/tsserverlibrary.d.ts | 2 + tests/baselines/reference/api/typescript.d.ts | 1 + .../callChainWithSuper(target=es2022).js | 18 +++ .../reference/callWithSpread4.symbols | 4 +- .../flatArrayNoExcessiveStackDepth.symbols | 2 +- .../importExportInternalComments.symbols | 2 +- .../indexAt(target=es2021).errors.txt | 56 ++++++++++ .../reference/indexAt(target=es2021).js | 30 +++++ .../reference/indexAt(target=es2021).symbols | 36 ++++++ .../reference/indexAt(target=es2021).types | 104 ++++++++++++++++++ .../reference/indexAt(target=es2022).js | 30 +++++ .../reference/indexAt(target=es2022).symbols | 64 +++++++++++ .../reference/indexAt(target=es2022).types | 104 ++++++++++++++++++ .../reference/indexAt(target=esnext).js | 30 +++++ .../reference/indexAt(target=esnext).symbols | 64 +++++++++++ .../reference/indexAt(target=esnext).types | 104 ++++++++++++++++++ .../reference/keyofAndIndexedAccess2.symbols | 12 +- .../noIterationTypeErrorsInCFA.symbols | 2 +- .../taggedTemplatesWithTypeArguments1.symbols | 2 +- ...does-not-add-color-when-NO_COLOR-is-set.js | 4 +- ...-when-host-can't-provide-terminal-width.js | 4 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 4 +- .../typeGuardConstructorNarrowAny.symbols | 4 +- ...typeGuardConstructorPrimitiveTypes.symbols | 8 +- tests/cases/compiler/indexAt.ts | 15 +++ 37 files changed, 842 insertions(+), 37 deletions(-) create mode 100644 src/lib/es2022.array.d.ts create mode 100644 src/lib/es2022.d.ts create mode 100644 src/lib/es2022.full.d.ts create mode 100644 src/lib/es2022.string.d.ts create mode 100644 tests/baselines/reference/callChainWithSuper(target=es2022).js create mode 100644 tests/baselines/reference/indexAt(target=es2021).errors.txt create mode 100644 tests/baselines/reference/indexAt(target=es2021).js create mode 100644 tests/baselines/reference/indexAt(target=es2021).symbols create mode 100644 tests/baselines/reference/indexAt(target=es2021).types create mode 100644 tests/baselines/reference/indexAt(target=es2022).js create mode 100644 tests/baselines/reference/indexAt(target=es2022).symbols create mode 100644 tests/baselines/reference/indexAt(target=es2022).types create mode 100644 tests/baselines/reference/indexAt(target=esnext).js create mode 100644 tests/baselines/reference/indexAt(target=esnext).symbols create mode 100644 tests/baselines/reference/indexAt(target=esnext).types create mode 100644 tests/cases/compiler/indexAt.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 676b995d8c96a..7c9f02f58fea2 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -29,6 +29,7 @@ namespace ts { ["es2019", "lib.es2019.d.ts"], ["es2020", "lib.es2020.d.ts"], ["es2021", "lib.es2021.d.ts"], + ["es2022", "lib.es2022.d.ts"], ["esnext", "lib.esnext.d.ts"], // Host only ["dom", "lib.dom.d.ts"], @@ -72,12 +73,14 @@ namespace ts { ["es2021.string", "lib.es2021.string.d.ts"], ["es2021.weakref", "lib.es2021.weakref.d.ts"], ["es2021.intl", "lib.es2021.intl.d.ts"], - ["esnext.array", "lib.es2019.array.d.ts"], + ["es2022.array", "lib.es2022.array.d.ts"], + ["es2022.string", "lib.es2022.string.d.ts"], + ["esnext.array", "lib.es2022.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], ["esnext.bigint", "lib.es2020.bigint.d.ts"], - ["esnext.string", "lib.es2021.string.d.ts"], + ["esnext.string", "lib.es2022.string.d.ts"], ["esnext.promise", "lib.es2021.promise.d.ts"], ["esnext.weakref", "lib.es2021.weakref.d.ts"] ]; @@ -308,6 +311,7 @@ namespace ts { es2019: ScriptTarget.ES2019, es2020: ScriptTarget.ES2020, es2021: ScriptTarget.ES2021, + es2022: ScriptTarget.ES2022, esnext: ScriptTarget.ESNext, })), affectsSourceFile: true, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index beff69baaa11b..ddce41f66d732 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6254,6 +6254,7 @@ namespace ts { ES2019 = 6, ES2020 = 7, ES2021 = 8, + ES2022 = 9, ESNext = 99, JSON = 100, Latest = ESNext, @@ -6699,15 +6700,16 @@ namespace ts { ContainsTypeScript = 1 << 0, ContainsJsx = 1 << 1, ContainsESNext = 1 << 2, - ContainsES2021 = 1 << 3, - ContainsES2020 = 1 << 4, - ContainsES2019 = 1 << 5, - ContainsES2018 = 1 << 6, - ContainsES2017 = 1 << 7, - ContainsES2016 = 1 << 8, - ContainsES2015 = 1 << 9, - ContainsGenerator = 1 << 10, - ContainsDestructuringAssignment = 1 << 11, + ContainsES2022 = 1 << 3, + ContainsES2021 = 1 << 4, + ContainsES2020 = 1 << 5, + ContainsES2019 = 1 << 6, + ContainsES2018 = 1 << 7, + ContainsES2017 = 1 << 8, + ContainsES2016 = 1 << 9, + ContainsES2015 = 1 << 10, + ContainsGenerator = 1 << 11, + ContainsDestructuringAssignment = 1 << 12, // Markers // - Flags used to indicate that a subtree contains a specific transformation. @@ -6736,6 +6738,7 @@ namespace ts { AssertTypeScript = ContainsTypeScript, AssertJsx = ContainsJsx, AssertESNext = ContainsESNext, + AssertES2022 = ContainsES2022, AssertES2021 = ContainsES2021, AssertES2020 = ContainsES2020, AssertES2019 = ContainsES2019, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 4b225a0ad0e99..af417e8542730 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -627,6 +627,21 @@ namespace ts { PromiseConstructor: ["any"], String: ["replaceAll"] }, + es2022: { + Array: ["at"], + String: ["at"], + Int8Array: ["at"], + Uint8Array: ["at"], + Uint8ClampedArray: ["at"], + Int16Array: ["at"], + Uint16Array: ["at"], + Int32Array: ["at"], + Uint32Array: ["at"], + Float32Array: ["at"], + Float64Array: ["at"], + BigInt64Array: ["at"], + BigUint64Array: ["at"], + }, esnext: { NumberFormat: ["formatToParts"] } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index d638ec32a8270..8f834e5e45971 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -14,6 +14,8 @@ namespace ts { switch (getEmitScriptTarget(options)) { case ScriptTarget.ESNext: return "lib.esnext.full.d.ts"; + case ScriptTarget.ES2022: + return "lib.es2022.full.d.ts"; case ScriptTarget.ES2021: return "lib.es2021.full.d.ts"; case ScriptTarget.ES2020: diff --git a/src/lib/es2022.array.d.ts b/src/lib/es2022.array.d.ts new file mode 100644 index 0000000000000..7be111c7f0663 --- /dev/null +++ b/src/lib/es2022.array.d.ts @@ -0,0 +1,103 @@ +interface Array { + /** + * 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; +} + +interface ReadonlyArray { + /** + * 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; +} + +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; +} + +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; +} + +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; +} + +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; +} + +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; +} + +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; +} + +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; +} + +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; +} + +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; +} + +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; +} + +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; +} diff --git a/src/lib/es2022.d.ts b/src/lib/es2022.d.ts new file mode 100644 index 0000000000000..cb772d56bc2bd --- /dev/null +++ b/src/lib/es2022.d.ts @@ -0,0 +1,3 @@ +/// +/// +/// diff --git a/src/lib/es2022.full.d.ts b/src/lib/es2022.full.d.ts new file mode 100644 index 0000000000000..f7a8fdc84c167 --- /dev/null +++ b/src/lib/es2022.full.d.ts @@ -0,0 +1,5 @@ +/// +/// +/// +/// +/// diff --git a/src/lib/es2022.string.d.ts b/src/lib/es2022.string.d.ts new file mode 100644 index 0000000000000..13b62eae3f89c --- /dev/null +++ b/src/lib/es2022.string.d.ts @@ -0,0 +1,7 @@ +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; +} diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index 4a3ac819c1900..6735ced8f7367 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -1,2 +1,2 @@ -/// +/// /// diff --git a/src/lib/libs.json b/src/lib/libs.json index 4131d45171b23..c40a26909affc 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -9,6 +9,7 @@ "es2019", "es2020", "es2021", + "es2022", "esnext", // Host only "dom.generated", @@ -52,6 +53,8 @@ "es2021.promise", "es2021.weakref", "es2021.intl", + "es2022.array", + "es2022.string", "esnext.intl", // Default libraries "es5.full", @@ -62,6 +65,7 @@ "es2019.full", "es2020.full", "es2021.full", + "es2022.full", "esnext.full" ], "paths": { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 67d6fda2a3b1b..d52148154a064 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -3509,6 +3509,7 @@ namespace ts.server.protocol { ES2019 = "ES2019", ES2020 = "ES2020", ES2021 = "ES2021", + ES2022 = "ES2022", ESNext = "ESNext" } diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 500f249288de9..abf3b7cf857b6 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -211,7 +211,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'esnext'.", + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 349e025e58eea..40154b5528004 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3076,6 +3076,7 @@ declare namespace ts { ES2019 = 6, ES2020 = 7, ES2021 = 8, + ES2022 = 9, ESNext = 99, JSON = 100, Latest = 99 @@ -9656,6 +9657,7 @@ declare namespace ts.server.protocol { ES2019 = "ES2019", ES2020 = "ES2020", ES2021 = "ES2021", + ES2022 = "ES2022", ESNext = "ESNext" } enum ClassificationType { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 2a2c398553ce8..af7b6edbbd30f 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3076,6 +3076,7 @@ declare namespace ts { ES2019 = 6, ES2020 = 7, ES2021 = 8, + ES2022 = 9, ESNext = 99, JSON = 100, Latest = 99 diff --git a/tests/baselines/reference/callChainWithSuper(target=es2022).js b/tests/baselines/reference/callChainWithSuper(target=es2022).js new file mode 100644 index 0000000000000..30e1ad3886dc5 --- /dev/null +++ b/tests/baselines/reference/callChainWithSuper(target=es2022).js @@ -0,0 +1,18 @@ +//// [callChainWithSuper.ts] +// GH#34952 +class Base { method?() {} } +class Derived extends Base { + method1() { return super.method?.(); } + method2() { return super["method"]?.(); } +} + +//// [callChainWithSuper.js] +"use strict"; +// GH#34952 +class Base { + method() { } +} +class Derived extends Base { + method1() { return super.method?.(); } + method2() { return super["method"]?.(); } +} diff --git a/tests/baselines/reference/callWithSpread4.symbols b/tests/baselines/reference/callWithSpread4.symbols index dbb7576582895..428f41b17c340 100644 --- a/tests/baselines/reference/callWithSpread4.symbols +++ b/tests/baselines/reference/callWithSpread4.symbols @@ -30,7 +30,7 @@ declare const pli: { (streams: ReadonlyArray): Promise; >streams : Symbol(streams, Decl(callWithSpread4.ts, 5, 5)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) >R : Symbol(R, Decl(callWithSpread4.ts, 0, 0)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) @@ -43,7 +43,7 @@ declare const pli: { >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >streams : Symbol(streams, Decl(callWithSpread4.ts, 6, 23)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) diff --git a/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols b/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols index 4b27f6006cbd7..bbd3083d04c40 100644 --- a/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols +++ b/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols @@ -15,7 +15,7 @@ const bar = foo.flatMap(bar => bar as Foo); interface Foo extends Array {} >Foo : Symbol(Foo, Decl(flatArrayNoExcessiveStackDepth.ts, 3, 43)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) // Repros from comments in #43249 diff --git a/tests/baselines/reference/importExportInternalComments.symbols b/tests/baselines/reference/importExportInternalComments.symbols index 87eeb2d31e9c9..e4c5f85d9bd77 100644 --- a/tests/baselines/reference/importExportInternalComments.symbols +++ b/tests/baselines/reference/importExportInternalComments.symbols @@ -4,7 +4,7 @@ declare module "foo"; === tests/cases/compiler/default.ts === /*1*/ export /*2*/ default /*3*/ Array /*4*/; ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) === tests/cases/compiler/index.ts === /*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo"; diff --git a/tests/baselines/reference/indexAt(target=es2021).errors.txt b/tests/baselines/reference/indexAt(target=es2021).errors.txt new file mode 100644 index 0000000000000..9307c2f7d5623 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).errors.txt @@ -0,0 +1,56 @@ +tests/cases/compiler/indexAt.ts(1,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(2,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(3,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(4,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(5,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(6,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(7,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(8,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(9,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(10,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(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 (13 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. + "foo".at(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(0); + ~~ +!!! 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(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. + \ No newline at end of file diff --git a/tests/baselines/reference/indexAt(target=es2021).js b/tests/baselines/reference/indexAt(target=es2021).js new file mode 100644 index 0000000000000..01ffbff491904 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).js @@ -0,0 +1,30 @@ +//// [indexAt.ts] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); + + +//// [indexAt.js] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); diff --git a/tests/baselines/reference/indexAt(target=es2021).symbols b/tests/baselines/reference/indexAt(target=es2021).symbols new file mode 100644 index 0000000000000..383f372fadd3e --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).symbols @@ -0,0 +1,36 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + +new BigUint64Array().at(0); +>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=es2021).types b/tests/baselines/reference/indexAt(target=es2021).types new file mode 100644 index 0000000000000..8229bcacb9328 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).types @@ -0,0 +1,104 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at(0) : any +>[0].at : any +>[0] : number[] +>0 : 0 +>at : any +>0 : 0 + +"foo".at(0); +>"foo".at(0) : any +>"foo".at : any +>"foo" : "foo" +>at : any +>0 : 0 + +new Int8Array().at(0); +>new Int8Array().at(0) : any +>new Int8Array().at : any +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>at : any +>0 : 0 + +new Uint8Array().at(0); +>new Uint8Array().at(0) : any +>new Uint8Array().at : any +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>at : any +>0 : 0 + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at(0) : any +>new Uint8ClampedArray().at : any +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>at : any +>0 : 0 + +new Int16Array().at(0); +>new Int16Array().at(0) : any +>new Int16Array().at : any +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>at : any +>0 : 0 + +new Uint16Array().at(0); +>new Uint16Array().at(0) : any +>new Uint16Array().at : any +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>at : any +>0 : 0 + +new Int32Array().at(0); +>new Int32Array().at(0) : any +>new Int32Array().at : any +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>at : any +>0 : 0 + +new Uint32Array().at(0); +>new Uint32Array().at(0) : any +>new Uint32Array().at : any +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>at : any +>0 : 0 + +new Float32Array().at(0); +>new Float32Array().at(0) : any +>new Float32Array().at : any +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>at : any +>0 : 0 + +new Float64Array().at(0); +>new Float64Array().at(0) : any +>new Float64Array().at : any +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>at : any +>0 : 0 + +new BigInt64Array().at(0); +>new BigInt64Array().at(0) : any +>new BigInt64Array().at : any +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>at : any +>0 : 0 + +new BigUint64Array().at(0); +>new BigUint64Array().at(0) : any +>new BigUint64Array().at : any +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>at : any +>0 : 0 + diff --git a/tests/baselines/reference/indexAt(target=es2022).js b/tests/baselines/reference/indexAt(target=es2022).js new file mode 100644 index 0000000000000..01ffbff491904 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2022).js @@ -0,0 +1,30 @@ +//// [indexAt.ts] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); + + +//// [indexAt.js] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); diff --git a/tests/baselines/reference/indexAt(target=es2022).symbols b/tests/baselines/reference/indexAt(target=es2022).symbols new file mode 100644 index 0000000000000..09b7425331f42 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2022).symbols @@ -0,0 +1,64 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +"foo".at(0); +>"foo".at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) +>at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) + +new Int8Array().at(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=es2022).types b/tests/baselines/reference/indexAt(target=es2022).types new file mode 100644 index 0000000000000..36fbb503e4258 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2022).types @@ -0,0 +1,104 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at(0) : number +>[0].at : (index: number) => number +>[0] : number[] +>0 : 0 +>at : (index: number) => number +>0 : 0 + +"foo".at(0); +>"foo".at(0) : string +>"foo".at : (index: number) => string +>"foo" : "foo" +>at : (index: number) => string +>0 : 0 + +new Int8Array().at(0); +>new Int8Array().at(0) : number +>new Int8Array().at : (index: number) => number +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8Array().at(0); +>new Uint8Array().at(0) : number +>new Uint8Array().at : (index: number) => number +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at(0) : number +>new Uint8ClampedArray().at : (index: number) => number +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int16Array().at(0); +>new Int16Array().at(0) : number +>new Int16Array().at : (index: number) => number +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint16Array().at(0); +>new Uint16Array().at(0) : number +>new Uint16Array().at : (index: number) => number +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int32Array().at(0); +>new Int32Array().at(0) : number +>new Int32Array().at : (index: number) => number +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint32Array().at(0); +>new Uint32Array().at(0) : number +>new Uint32Array().at : (index: number) => number +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float32Array().at(0); +>new Float32Array().at(0) : number +>new Float32Array().at : (index: number) => number +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float64Array().at(0); +>new Float64Array().at(0) : number +>new Float64Array().at : (index: number) => number +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new BigInt64Array().at(0); +>new BigInt64Array().at(0) : number +>new BigInt64Array().at : (index: number) => number +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new BigUint64Array().at(0); +>new BigUint64Array().at(0) : number +>new BigUint64Array().at : (index: number) => number +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>at : (index: number) => number +>0 : 0 + diff --git a/tests/baselines/reference/indexAt(target=esnext).js b/tests/baselines/reference/indexAt(target=esnext).js new file mode 100644 index 0000000000000..01ffbff491904 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=esnext).js @@ -0,0 +1,30 @@ +//// [indexAt.ts] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); + + +//// [indexAt.js] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); diff --git a/tests/baselines/reference/indexAt(target=esnext).symbols b/tests/baselines/reference/indexAt(target=esnext).symbols new file mode 100644 index 0000000000000..09b7425331f42 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=esnext).symbols @@ -0,0 +1,64 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +"foo".at(0); +>"foo".at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) +>at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) + +new Int8Array().at(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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(0); +>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, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=esnext).types b/tests/baselines/reference/indexAt(target=esnext).types new file mode 100644 index 0000000000000..36fbb503e4258 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=esnext).types @@ -0,0 +1,104 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at(0) : number +>[0].at : (index: number) => number +>[0] : number[] +>0 : 0 +>at : (index: number) => number +>0 : 0 + +"foo".at(0); +>"foo".at(0) : string +>"foo".at : (index: number) => string +>"foo" : "foo" +>at : (index: number) => string +>0 : 0 + +new Int8Array().at(0); +>new Int8Array().at(0) : number +>new Int8Array().at : (index: number) => number +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8Array().at(0); +>new Uint8Array().at(0) : number +>new Uint8Array().at : (index: number) => number +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at(0) : number +>new Uint8ClampedArray().at : (index: number) => number +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int16Array().at(0); +>new Int16Array().at(0) : number +>new Int16Array().at : (index: number) => number +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint16Array().at(0); +>new Uint16Array().at(0) : number +>new Uint16Array().at : (index: number) => number +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int32Array().at(0); +>new Int32Array().at(0) : number +>new Int32Array().at : (index: number) => number +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint32Array().at(0); +>new Uint32Array().at(0) : number +>new Uint32Array().at : (index: number) => number +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float32Array().at(0); +>new Float32Array().at(0) : number +>new Float32Array().at : (index: number) => number +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float64Array().at(0); +>new Float64Array().at(0) : number +>new Float64Array().at : (index: number) => number +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new BigInt64Array().at(0); +>new BigInt64Array().at(0) : number +>new BigInt64Array().at : (index: number) => number +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new BigUint64Array().at(0); +>new BigUint64Array().at(0) : number +>new BigUint64Array().at : (index: number) => number +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>at : (index: number) => number +>0 : 0 + diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index 1c3758c137d3e..a17aafe571aa5 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -440,9 +440,9 @@ function fn} | {elements: Array}>(par >fn : Symbol(fn, Decl(keyofAndIndexedAccess2.ts, 115, 69)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 119, 12)) >elements : Symbol(elements, Decl(keyofAndIndexedAccess2.ts, 119, 23)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >elements : Symbol(elements, Decl(keyofAndIndexedAccess2.ts, 119, 51)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 119, 77)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 119, 12)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 119, 86)) @@ -459,7 +459,7 @@ function fn} | {elements: Array}>(par function fn2>(param: T, cb: (element: T[number]) => void) { >fn2 : Symbol(fn2, Decl(keyofAndIndexedAccess2.ts, 121, 1)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 123, 13)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 123, 38)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 123, 13)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 123, 47)) @@ -476,7 +476,7 @@ function fn2>(param: T, cb: (element: T[number]) => void function fn3>(param: T, cb: (element: T[number]) => void) { >fn3 : Symbol(fn3, Decl(keyofAndIndexedAccess2.ts, 125, 1)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 129, 46)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 129, 55)) @@ -494,12 +494,12 @@ function fn4() { let x: Array[K] = 'abc'; >x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 134, 7)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) let y: ReadonlyArray[K] = 'abc'; >y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 135, 7)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) } diff --git a/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols b/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols index 3498f52d456f3..60040c3ed17c4 100644 --- a/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols +++ b/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols @@ -13,7 +13,7 @@ export function doRemove(dds: F | F[]) { if (!Array.isArray(dds)) { >Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) >dds : Symbol(dds, Decl(noIterationTypeErrorsInCFA.ts, 3, 25)) diff --git a/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols b/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols index 4cd6dce23e368..f37166423f17c 100644 --- a/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols +++ b/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols @@ -5,7 +5,7 @@ declare function f(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => >strs : Symbol(strs, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 22)) >TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >callbacks : Symbol(callbacks, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 49)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >x : Symbol(x, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 71)) >T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 19)) diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js index 100d910dfbaba..f52c4c9add726 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js @@ -68,7 +68,7 @@ default: true --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext default: ES3 --module, -m @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 3b4922b2fe603..51d8ffdd89551 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -68,7 +68,7 @@ default: true --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext default: ES3 --module, -m @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 3b4922b2fe603..51d8ffdd89551 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -68,7 +68,7 @@ default: true --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext default: ES3 --module, -m @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols index acbc179aa270d..980e68c3f1cf9 100644 --- a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols +++ b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols @@ -5,7 +5,7 @@ let var1: any; if (var1.constructor === String) { >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) var1; // String >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) @@ -26,7 +26,7 @@ if (var1.constructor === Boolean) { } if (var1.constructor === Array) { >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) var1; // any[] >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) diff --git a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols index 1bcc2f586eb5e..7258c198d18f7 100644 --- a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols +++ b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols @@ -7,7 +7,7 @@ if (var1.constructor === String) { >var1.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) >constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) var1; // string >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) @@ -34,7 +34,7 @@ if (var1.constructor === Array) { >var1.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) >constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) var1; // any[] >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) @@ -61,7 +61,7 @@ if (var1.constructor === BigInt) { // Narrow a union of primitive object types let var2: String | Number | Boolean | Symbol | BigInt; >var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) @@ -71,7 +71,7 @@ if (var2.constructor === String) { >var2.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3)) >constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) var2; // String >var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3)) diff --git a/tests/cases/compiler/indexAt.ts b/tests/cases/compiler/indexAt.ts new file mode 100644 index 0000000000000..d41117903a5b1 --- /dev/null +++ b/tests/cases/compiler/indexAt.ts @@ -0,0 +1,15 @@ +// @target: es2021, es2022, esnext + +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); From 63a65d703376a3b43d8506170f8c036809aa2bba Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 10 Oct 2021 14:16:44 +0200 Subject: [PATCH 2/9] Add Object.hasOwn --- src/compiler/commandLineParser.ts | 1 + src/compiler/utilities.ts | 1 + src/lib/es2022.array.d.ts | 130 +++++++++--------- src/lib/es2022.d.ts | 1 + src/lib/es2022.object.d.ts | 8 ++ src/lib/es2022.string.d.ts | 10 +- src/lib/libs.json | 1 + .../esNextWeakRefs_IterableWeakMap.symbols | 4 +- ...ptionalPropertiesToIndexSignatures.symbols | 2 +- ...does-not-add-color-when-NO_COLOR-is-set.js | 2 +- ...-when-host-can't-provide-terminal-width.js | 2 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 2 +- .../reference/unionTypeInference.symbols | 2 +- 13 files changed, 89 insertions(+), 77 deletions(-) create mode 100644 src/lib/es2022.object.d.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 7c9f02f58fea2..e8acb48150c73 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -74,6 +74,7 @@ namespace ts { ["es2021.weakref", "lib.es2021.weakref.d.ts"], ["es2021.intl", "lib.es2021.intl.d.ts"], ["es2022.array", "lib.es2022.array.d.ts"], + ["es2022.object", "lib.es2022.object.d.ts"], ["es2022.string", "lib.es2022.string.d.ts"], ["esnext.array", "lib.es2022.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index af417e8542730..590ca6130f94e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -641,6 +641,7 @@ namespace ts { Float64Array: ["at"], BigInt64Array: ["at"], BigUint64Array: ["at"], + ObjectConstructor: ["hasOwn"], }, esnext: { NumberFormat: ["formatToParts"] diff --git a/src/lib/es2022.array.d.ts b/src/lib/es2022.array.d.ts index 7be111c7f0663..e0e0d2c81dfcf 100644 --- a/src/lib/es2022.array.d.ts +++ b/src/lib/es2022.array.d.ts @@ -1,103 +1,103 @@ interface Array { - /** - * 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; + /** + * 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; } interface ReadonlyArray { - /** - * 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } 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; + /** + * 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; } diff --git a/src/lib/es2022.d.ts b/src/lib/es2022.d.ts index cb772d56bc2bd..cd111c15e9f4b 100644 --- a/src/lib/es2022.d.ts +++ b/src/lib/es2022.d.ts @@ -1,3 +1,4 @@ /// /// +/// /// diff --git a/src/lib/es2022.object.d.ts b/src/lib/es2022.object.d.ts new file mode 100644 index 0000000000000..764610213b6ac --- /dev/null +++ b/src/lib/es2022.object.d.ts @@ -0,0 +1,8 @@ +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param o An object. + * @param v A property name. + */ + hasOwn(o: object, v: PropertyKey): boolean; +} diff --git a/src/lib/es2022.string.d.ts b/src/lib/es2022.string.d.ts index 13b62eae3f89c..cbb19f85268f3 100644 --- a/src/lib/es2022.string.d.ts +++ b/src/lib/es2022.string.d.ts @@ -1,7 +1,7 @@ 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; + /** + * 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; } diff --git a/src/lib/libs.json b/src/lib/libs.json index c40a26909affc..09788913e1fb7 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -54,6 +54,7 @@ "es2021.weakref", "es2021.intl", "es2022.array", + "es2022.object", "es2022.string", "esnext.intl", // Default libraries diff --git a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols index be0559bfe5251..cf1ed59e66d6e 100644 --- a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols +++ b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols @@ -297,7 +297,7 @@ export class IterableWeakMap implements WeakMap { Object.defineProperties(IterableWeakMap.prototype, { >Object.defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) >IterableWeakMap.prototype : Symbol(IterableWeakMap.prototype) >IterableWeakMap : Symbol(IterableWeakMap, Decl(esNextWeakRefs_IterableWeakMap.ts, 6, 2)) @@ -322,7 +322,7 @@ Object.defineProperties(IterableWeakMap.prototype, { >value : Symbol(value, Decl(esNextWeakRefs_IterableWeakMap.ts, 89, 23)) >Object.getOwnPropertyDescriptor( IterableWeakMap.prototype, "entries", )!.value : Symbol(PropertyDescriptor.value, Decl(lib.es5.d.ts, --, --)) >Object.getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) IterableWeakMap.prototype, diff --git a/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols b/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols index 9874e516a2b75..72d4478539d77 100644 --- a/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols +++ b/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols @@ -72,7 +72,7 @@ const query = Object.entries(obj).map( >Object.entries(obj).map( ([k, v]) => `${k}=${encodeURIComponent(v)}`).join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --)) >Object.entries(obj).map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >obj : Symbol(obj, Decl(inferenceOptionalPropertiesToIndexSignatures.ts, 16, 5)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js index f52c4c9add726..60a38d7286ed8 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 51d8ffdd89551..ae0a1c21e43f8 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 51d8ffdd89551..ae0a1c21e43f8 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/unionTypeInference.symbols b/tests/baselines/reference/unionTypeInference.symbols index 11fdc52396485..a4a24b15ebfcc 100644 --- a/tests/baselines/reference/unionTypeInference.symbols +++ b/tests/baselines/reference/unionTypeInference.symbols @@ -230,7 +230,7 @@ async function fun(deepPromised: DeepPromised) { for (const value of Object.values(deepPromisedWithIndexer)) { >value : Symbol(value, Decl(unionTypeInference.ts, 62, 14)) >Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >deepPromisedWithIndexer : Symbol(deepPromisedWithIndexer, Decl(unionTypeInference.ts, 61, 9)) From c940acb93e9068968e1652026b826b5fd7fe0535 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 10 Oct 2021 14:37:43 +0200 Subject: [PATCH 3/9] formatToParts is es2018 --- src/compiler/utilities.ts | 6 ++---- .../doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 590ca6130f94e..c3b589ab4d099 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -606,6 +606,7 @@ namespace ts { AsyncIterableIterator: emptyArray, AsyncGenerator: emptyArray, AsyncGeneratorFunction: emptyArray, + NumberFormat: ["formatToParts"] }, es2019: { Array: ["flat", "flatMap"], @@ -641,10 +642,7 @@ namespace ts { Float64Array: ["at"], BigInt64Array: ["at"], BigUint64Array: ["at"], - ObjectConstructor: ["hasOwn"], - }, - esnext: { - NumberFormat: ["formatToParts"] + ObjectConstructor: ["hasOwn"] } }; } diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt index ee42a781a6366..3e7a58d4b942f 100644 --- a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(20,27): err tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(21,35): error TS2583: Cannot find name 'AsyncGeneratorFunction'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(22,26): error TS2583: Cannot find name 'AsyncIterable'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(23,34): error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(24,70): error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(24,70): error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(27,26): error TS2550: Property 'flat' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(28,29): error TS2550: Property 'flatMap' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(29,49): error TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. @@ -95,7 +95,7 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(44,33): err !!! error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); ~~~~~~~~~~~~~ -!!! error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +!!! error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. // es2019 const testArrayFlat = [].flat(); From c341cd71ff6186664bb53a43ff2bf05d4167e956 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 27 Oct 2021 00:35:20 +0200 Subject: [PATCH 4/9] ref update --- .../reference/reactJsxReactResolvedNodeNext.trace.json | 8 ++++++++ .../reference/reactJsxReactResolvedNodeNextEsm.trace.json | 8 ++++++++ .../baselines/reference/recursiveConditionalTypes.symbols | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json index 00597f669b34b..04e4b3ec22497 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json @@ -131,5 +131,13 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json index 02a5d6a429932..2a015c1fd8f13 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json @@ -125,5 +125,13 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/recursiveConditionalTypes.symbols b/tests/baselines/reference/recursiveConditionalTypes.symbols index 3c77d93e71f13..e9b58df3c28a3 100644 --- a/tests/baselines/reference/recursiveConditionalTypes.symbols +++ b/tests/baselines/reference/recursiveConditionalTypes.symbols @@ -566,7 +566,7 @@ let five: Add<2, 3>; type _PrependNextNum> = A['length'] extends infer T >_PrependNextNum : Symbol(_PrependNextNum, Decl(recursiveConditionalTypes.ts, 147, 20)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 151, 21)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 151, 21)) >T : Symbol(T, Decl(recursiveConditionalTypes.ts, 151, 74)) @@ -584,7 +584,7 @@ type _PrependNextNum> = A['length'] extends infer T type _Enumerate, N extends number> = N extends A['length'] >_Enumerate : Symbol(_Enumerate, Decl(recursiveConditionalTypes.ts, 155, 12)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 157, 16)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >N : Symbol(N, Decl(recursiveConditionalTypes.ts, 157, 41)) >N : Symbol(N, Decl(recursiveConditionalTypes.ts, 157, 41)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 157, 16)) From e67d6e5f6062d72b830893e9988840779cb7fa8c Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 27 Oct 2021 00:54:54 +0200 Subject: [PATCH 5/9] optional parameter --- src/lib/es2022.array.d.ts | 26 ++-- src/lib/es2022.string.d.ts | 2 +- .../indexAt(target=es2021).errors.txt | 55 ++++++- .../reference/indexAt(target=es2021).js | 27 ++++ .../reference/indexAt(target=es2021).symbols | 35 +++++ .../reference/indexAt(target=es2021).types | 90 +++++++++++ .../reference/indexAt(target=es2022).js | 27 ++++ .../reference/indexAt(target=es2022).symbols | 63 ++++++++ .../reference/indexAt(target=es2022).types | 142 ++++++++++++++---- .../reference/indexAt(target=esnext).js | 27 ++++ .../reference/indexAt(target=esnext).symbols | 63 ++++++++ .../reference/indexAt(target=esnext).types | 142 ++++++++++++++---- tests/cases/compiler/indexAt.ts | 14 ++ 13 files changed, 646 insertions(+), 67 deletions(-) diff --git a/src/lib/es2022.array.d.ts b/src/lib/es2022.array.d.ts index e0e0d2c81dfcf..7f97dd66dab6a 100644 --- a/src/lib/es2022.array.d.ts +++ b/src/lib/es2022.array.d.ts @@ -3,7 +3,7 @@ interface Array { * 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 { @@ -11,7 +11,7 @@ interface ReadonlyArray { * 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; } diff --git a/src/lib/es2022.string.d.ts b/src/lib/es2022.string.d.ts index cbb19f85268f3..6b94984ad287f 100644 --- a/src/lib/es2022.string.d.ts +++ b/src/lib/es2022.string.d.ts @@ -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; } diff --git a/tests/baselines/reference/indexAt(target=es2021).errors.txt b/tests/baselines/reference/indexAt(target=es2021).errors.txt index 9307c2f7d5623..5a1240199523c 100644 --- a/tests/baselines/reference/indexAt(target=es2021).errors.txt +++ b/tests/baselines/reference/indexAt(target=es2021).errors.txt @@ -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. \ No newline at end of file diff --git a/tests/baselines/reference/indexAt(target=es2021).js b/tests/baselines/reference/indexAt(target=es2021).js index 01ffbff491904..06cd5259a4b56 100644 --- a/tests/baselines/reference/indexAt(target=es2021).js +++ b/tests/baselines/reference/indexAt(target=es2021).js @@ -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(); diff --git a/tests/baselines/reference/indexAt(target=es2021).symbols b/tests/baselines/reference/indexAt(target=es2021).symbols index 383f372fadd3e..7e11613285f0e 100644 --- a/tests/baselines/reference/indexAt(target=es2021).symbols +++ b/tests/baselines/reference/indexAt(target=es2021).symbols @@ -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, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=es2021).types b/tests/baselines/reference/indexAt(target=es2021).types index 8229bcacb9328..34283de8c65ca 100644 --- a/tests/baselines/reference/indexAt(target=es2021).types +++ b/tests/baselines/reference/indexAt(target=es2021).types @@ -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 + diff --git a/tests/baselines/reference/indexAt(target=es2022).js b/tests/baselines/reference/indexAt(target=es2022).js index 01ffbff491904..06cd5259a4b56 100644 --- a/tests/baselines/reference/indexAt(target=es2022).js +++ b/tests/baselines/reference/indexAt(target=es2022).js @@ -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(); diff --git a/tests/baselines/reference/indexAt(target=es2022).symbols b/tests/baselines/reference/indexAt(target=es2022).symbols index 09b7425331f42..cbf259fb6e01f 100644 --- a/tests/baselines/reference/indexAt(target=es2022).symbols +++ b/tests/baselines/reference/indexAt(target=es2022).symbols @@ -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, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=es2022).types b/tests/baselines/reference/indexAt(target=es2022).types index 36fbb503e4258..62dc9624a243a 100644 --- a/tests/baselines/reference/indexAt(target=es2022).types +++ b/tests/baselines/reference/indexAt(target=es2022).types @@ -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 + diff --git a/tests/baselines/reference/indexAt(target=esnext).js b/tests/baselines/reference/indexAt(target=esnext).js index 01ffbff491904..06cd5259a4b56 100644 --- a/tests/baselines/reference/indexAt(target=esnext).js +++ b/tests/baselines/reference/indexAt(target=esnext).js @@ -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(); diff --git a/tests/baselines/reference/indexAt(target=esnext).symbols b/tests/baselines/reference/indexAt(target=esnext).symbols index 09b7425331f42..cbf259fb6e01f 100644 --- a/tests/baselines/reference/indexAt(target=esnext).symbols +++ b/tests/baselines/reference/indexAt(target=esnext).symbols @@ -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, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=esnext).types b/tests/baselines/reference/indexAt(target=esnext).types index 36fbb503e4258..62dc9624a243a 100644 --- a/tests/baselines/reference/indexAt(target=esnext).types +++ b/tests/baselines/reference/indexAt(target=esnext).types @@ -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 + diff --git a/tests/cases/compiler/indexAt.ts b/tests/cases/compiler/indexAt.ts index d41117903a5b1..244bcad07a366 100644 --- a/tests/cases/compiler/indexAt.ts +++ b/tests/cases/compiler/indexAt.ts @@ -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(); From f384243b48ef87436fffc9b0d24cf331b8e6e6c3 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 29 Oct 2021 02:21:06 +0200 Subject: [PATCH 6/9] Revert "optional parameter" This reverts commit e67d6e5f6062d72b830893e9988840779cb7fa8c. --- src/lib/es2022.array.d.ts | 26 ++-- src/lib/es2022.string.d.ts | 2 +- .../indexAt(target=es2021).errors.txt | 55 +------ .../reference/indexAt(target=es2021).js | 27 ---- .../reference/indexAt(target=es2021).symbols | 35 ----- .../reference/indexAt(target=es2021).types | 90 ----------- .../reference/indexAt(target=es2022).js | 27 ---- .../reference/indexAt(target=es2022).symbols | 63 -------- .../reference/indexAt(target=es2022).types | 142 ++++-------------- .../reference/indexAt(target=esnext).js | 27 ---- .../reference/indexAt(target=esnext).symbols | 63 -------- .../reference/indexAt(target=esnext).types | 142 ++++-------------- tests/cases/compiler/indexAt.ts | 14 -- 13 files changed, 67 insertions(+), 646 deletions(-) diff --git a/src/lib/es2022.array.d.ts b/src/lib/es2022.array.d.ts index 7f97dd66dab6a..e0e0d2c81dfcf 100644 --- a/src/lib/es2022.array.d.ts +++ b/src/lib/es2022.array.d.ts @@ -3,7 +3,7 @@ interface Array { * 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 { @@ -11,7 +11,7 @@ interface ReadonlyArray { * 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; } diff --git a/src/lib/es2022.string.d.ts b/src/lib/es2022.string.d.ts index 6b94984ad287f..cbb19f85268f3 100644 --- a/src/lib/es2022.string.d.ts +++ b/src/lib/es2022.string.d.ts @@ -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; } diff --git a/tests/baselines/reference/indexAt(target=es2021).errors.txt b/tests/baselines/reference/indexAt(target=es2021).errors.txt index 5a1240199523c..9307c2f7d5623 100644 --- a/tests/baselines/reference/indexAt(target=es2021).errors.txt +++ b/tests/baselines/reference/indexAt(target=es2021).errors.txt @@ -11,22 +11,9 @@ 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 (26 errors) ==== +==== tests/cases/compiler/indexAt.ts (13 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. @@ -66,44 +53,4 @@ tests/cases/compiler/indexAt.ts(27,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. \ No newline at end of file diff --git a/tests/baselines/reference/indexAt(target=es2021).js b/tests/baselines/reference/indexAt(target=es2021).js index 06cd5259a4b56..01ffbff491904 100644 --- a/tests/baselines/reference/indexAt(target=es2021).js +++ b/tests/baselines/reference/indexAt(target=es2021).js @@ -12,20 +12,6 @@ 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] @@ -42,16 +28,3 @@ 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(); diff --git a/tests/baselines/reference/indexAt(target=es2021).symbols b/tests/baselines/reference/indexAt(target=es2021).symbols index 7e11613285f0e..383f372fadd3e 100644 --- a/tests/baselines/reference/indexAt(target=es2021).symbols +++ b/tests/baselines/reference/indexAt(target=es2021).symbols @@ -34,38 +34,3 @@ 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, --, --)) - diff --git a/tests/baselines/reference/indexAt(target=es2021).types b/tests/baselines/reference/indexAt(target=es2021).types index 34283de8c65ca..8229bcacb9328 100644 --- a/tests/baselines/reference/indexAt(target=es2021).types +++ b/tests/baselines/reference/indexAt(target=es2021).types @@ -102,93 +102,3 @@ 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 - diff --git a/tests/baselines/reference/indexAt(target=es2022).js b/tests/baselines/reference/indexAt(target=es2022).js index 06cd5259a4b56..01ffbff491904 100644 --- a/tests/baselines/reference/indexAt(target=es2022).js +++ b/tests/baselines/reference/indexAt(target=es2022).js @@ -12,20 +12,6 @@ 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] @@ -42,16 +28,3 @@ 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(); diff --git a/tests/baselines/reference/indexAt(target=es2022).symbols b/tests/baselines/reference/indexAt(target=es2022).symbols index cbf259fb6e01f..09b7425331f42 100644 --- a/tests/baselines/reference/indexAt(target=es2022).symbols +++ b/tests/baselines/reference/indexAt(target=es2022).symbols @@ -62,66 +62,3 @@ 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, --, --)) - diff --git a/tests/baselines/reference/indexAt(target=es2022).types b/tests/baselines/reference/indexAt(target=es2022).types index 62dc9624a243a..36fbb503e4258 100644 --- a/tests/baselines/reference/indexAt(target=es2022).types +++ b/tests/baselines/reference/indexAt(target=es2022).types @@ -1,194 +1,104 @@ === 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 - diff --git a/tests/baselines/reference/indexAt(target=esnext).js b/tests/baselines/reference/indexAt(target=esnext).js index 06cd5259a4b56..01ffbff491904 100644 --- a/tests/baselines/reference/indexAt(target=esnext).js +++ b/tests/baselines/reference/indexAt(target=esnext).js @@ -12,20 +12,6 @@ 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] @@ -42,16 +28,3 @@ 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(); diff --git a/tests/baselines/reference/indexAt(target=esnext).symbols b/tests/baselines/reference/indexAt(target=esnext).symbols index cbf259fb6e01f..09b7425331f42 100644 --- a/tests/baselines/reference/indexAt(target=esnext).symbols +++ b/tests/baselines/reference/indexAt(target=esnext).symbols @@ -62,66 +62,3 @@ 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, --, --)) - diff --git a/tests/baselines/reference/indexAt(target=esnext).types b/tests/baselines/reference/indexAt(target=esnext).types index 62dc9624a243a..36fbb503e4258 100644 --- a/tests/baselines/reference/indexAt(target=esnext).types +++ b/tests/baselines/reference/indexAt(target=esnext).types @@ -1,194 +1,104 @@ === 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 - diff --git a/tests/cases/compiler/indexAt.ts b/tests/cases/compiler/indexAt.ts index 244bcad07a366..d41117903a5b1 100644 --- a/tests/cases/compiler/indexAt.ts +++ b/tests/cases/compiler/indexAt.ts @@ -13,17 +13,3 @@ 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(); From 95b4ad8813368b15a8df1b5e6ea9e6d96b2b5516 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 29 Oct 2021 02:50:56 +0200 Subject: [PATCH 7/9] undefined --- src/lib/es2022.array.d.ts | 26 +++++++++++++------------- src/lib/es2022.string.d.ts | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib/es2022.array.d.ts b/src/lib/es2022.array.d.ts index e0e0d2c81dfcf..2c68a99c91e1f 100644 --- a/src/lib/es2022.array.d.ts +++ b/src/lib/es2022.array.d.ts @@ -3,7 +3,7 @@ interface Array { * 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 | undefined; } interface ReadonlyArray { @@ -11,7 +11,7 @@ interface ReadonlyArray { * 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | undefined; } 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 | 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; + at(index: number): number | undefined; } diff --git a/src/lib/es2022.string.d.ts b/src/lib/es2022.string.d.ts index cbb19f85268f3..23f4a0123f269 100644 --- a/src/lib/es2022.string.d.ts +++ b/src/lib/es2022.string.d.ts @@ -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 | undefined; } From 5ebce828ba28694b26afbfd13f4ad6a788395c98 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 29 Oct 2021 03:32:02 +0200 Subject: [PATCH 8/9] error cause --- src/compiler/commandLineParser.ts | 1 + src/lib/es2022.d.ts | 1 + src/lib/es2022.error.d.ts | 8 ++++++++ src/lib/libs.json | 1 + .../reference/errorCause(target=es2021).errors.txt | 8 ++++++++ .../baselines/reference/errorCause(target=es2021).js | 6 ++++++ .../reference/errorCause(target=es2021).symbols | 6 ++++++ .../reference/errorCause(target=es2021).types | 11 +++++++++++ .../baselines/reference/errorCause(target=es2022).js | 6 ++++++ .../reference/errorCause(target=es2022).symbols | 6 ++++++ .../reference/errorCause(target=es2022).types | 11 +++++++++++ .../baselines/reference/errorCause(target=esnext).js | 6 ++++++ .../reference/errorCause(target=esnext).symbols | 6 ++++++ .../reference/errorCause(target=esnext).types | 11 +++++++++++ .../reactJsxReactResolvedNodeNext.trace.json | 2 ++ .../reactJsxReactResolvedNodeNextEsm.trace.json | 2 ++ .../does-not-add-color-when-NO_COLOR-is-set.js | 2 +- ...sSkipped-when-host-can't-provide-terminal-width.js | 2 +- ...th-ExitStatus.DiagnosticsPresent_OutputsSkipped.js | 2 +- tests/cases/compiler/errorCause.ts | 3 +++ 20 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 src/lib/es2022.error.d.ts create mode 100644 tests/baselines/reference/errorCause(target=es2021).errors.txt create mode 100644 tests/baselines/reference/errorCause(target=es2021).js create mode 100644 tests/baselines/reference/errorCause(target=es2021).symbols create mode 100644 tests/baselines/reference/errorCause(target=es2021).types create mode 100644 tests/baselines/reference/errorCause(target=es2022).js create mode 100644 tests/baselines/reference/errorCause(target=es2022).symbols create mode 100644 tests/baselines/reference/errorCause(target=es2022).types create mode 100644 tests/baselines/reference/errorCause(target=esnext).js create mode 100644 tests/baselines/reference/errorCause(target=esnext).symbols create mode 100644 tests/baselines/reference/errorCause(target=esnext).types create mode 100644 tests/cases/compiler/errorCause.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4de97d696dc10..b9d39151148a1 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -74,6 +74,7 @@ namespace ts { ["es2021.weakref", "lib.es2021.weakref.d.ts"], ["es2021.intl", "lib.es2021.intl.d.ts"], ["es2022.array", "lib.es2022.array.d.ts"], + ["es2022.error", "lib.es2022.error.d.ts"], ["es2022.object", "lib.es2022.object.d.ts"], ["es2022.string", "lib.es2022.string.d.ts"], ["esnext.array", "lib.es2022.array.d.ts"], diff --git a/src/lib/es2022.d.ts b/src/lib/es2022.d.ts index cd111c15e9f4b..67a9199b5d6f4 100644 --- a/src/lib/es2022.d.ts +++ b/src/lib/es2022.d.ts @@ -1,4 +1,5 @@ /// /// +/// /// /// diff --git a/src/lib/es2022.error.d.ts b/src/lib/es2022.error.d.ts new file mode 100644 index 0000000000000..204c9e59d55e3 --- /dev/null +++ b/src/lib/es2022.error.d.ts @@ -0,0 +1,8 @@ +interface ErrorOptions { + cause?: Error; +} + +interface ErrorConstructor { + new(message?: string, options?: ErrorOptions): Error; + (message?: string, options?: ErrorOptions): Error; +} diff --git a/src/lib/libs.json b/src/lib/libs.json index 09788913e1fb7..e4434e89ea64a 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -54,6 +54,7 @@ "es2021.weakref", "es2021.intl", "es2022.array", + "es2022.error", "es2022.object", "es2022.string", "esnext.intl", diff --git a/tests/baselines/reference/errorCause(target=es2021).errors.txt b/tests/baselines/reference/errorCause(target=es2021).errors.txt new file mode 100644 index 0000000000000..4cac6368fccb4 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/errorCause.ts(1,18): error TS2554: Expected 0-1 arguments, but got 2. + + +==== tests/cases/compiler/errorCause.ts (1 errors) ==== + new Error("foo", { cause: new Error("bar") }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 0-1 arguments, but got 2. + \ No newline at end of file diff --git a/tests/baselines/reference/errorCause(target=es2021).js b/tests/baselines/reference/errorCause(target=es2021).js new file mode 100644 index 0000000000000..24432cbe9625b --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).js @@ -0,0 +1,6 @@ +//// [errorCause.ts] +new Error("foo", { cause: new Error("bar") }); + + +//// [errorCause.js] +new Error("foo", { cause: new Error("bar") }); diff --git a/tests/baselines/reference/errorCause(target=es2021).symbols b/tests/baselines/reference/errorCause(target=es2021).symbols new file mode 100644 index 0000000000000..0fe6616b0a8b7 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>cause : Symbol(cause, Decl(errorCause.ts, 0, 18)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/errorCause(target=es2021).types b/tests/baselines/reference/errorCause(target=es2021).types new file mode 100644 index 0000000000000..e92889262730c --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>new Error("foo", { cause: new Error("bar") }) : Error +>Error : ErrorConstructor +>"foo" : "foo" +>{ cause: new Error("bar") } : { cause: Error; } +>cause : Error +>new Error("bar") : Error +>Error : ErrorConstructor +>"bar" : "bar" + diff --git a/tests/baselines/reference/errorCause(target=es2022).js b/tests/baselines/reference/errorCause(target=es2022).js new file mode 100644 index 0000000000000..24432cbe9625b --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2022).js @@ -0,0 +1,6 @@ +//// [errorCause.ts] +new Error("foo", { cause: new Error("bar") }); + + +//// [errorCause.js] +new Error("foo", { cause: new Error("bar") }); diff --git a/tests/baselines/reference/errorCause(target=es2022).symbols b/tests/baselines/reference/errorCause(target=es2022).symbols new file mode 100644 index 0000000000000..0fe6616b0a8b7 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2022).symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>cause : Symbol(cause, Decl(errorCause.ts, 0, 18)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/errorCause(target=es2022).types b/tests/baselines/reference/errorCause(target=es2022).types new file mode 100644 index 0000000000000..e92889262730c --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2022).types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>new Error("foo", { cause: new Error("bar") }) : Error +>Error : ErrorConstructor +>"foo" : "foo" +>{ cause: new Error("bar") } : { cause: Error; } +>cause : Error +>new Error("bar") : Error +>Error : ErrorConstructor +>"bar" : "bar" + diff --git a/tests/baselines/reference/errorCause(target=esnext).js b/tests/baselines/reference/errorCause(target=esnext).js new file mode 100644 index 0000000000000..24432cbe9625b --- /dev/null +++ b/tests/baselines/reference/errorCause(target=esnext).js @@ -0,0 +1,6 @@ +//// [errorCause.ts] +new Error("foo", { cause: new Error("bar") }); + + +//// [errorCause.js] +new Error("foo", { cause: new Error("bar") }); diff --git a/tests/baselines/reference/errorCause(target=esnext).symbols b/tests/baselines/reference/errorCause(target=esnext).symbols new file mode 100644 index 0000000000000..0fe6616b0a8b7 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=esnext).symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>cause : Symbol(cause, Decl(errorCause.ts, 0, 18)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/errorCause(target=esnext).types b/tests/baselines/reference/errorCause(target=esnext).types new file mode 100644 index 0000000000000..e92889262730c --- /dev/null +++ b/tests/baselines/reference/errorCause(target=esnext).types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>new Error("foo", { cause: new Error("bar") }) : Error +>Error : ErrorConstructor +>"foo" : "foo" +>{ cause: new Error("bar") } : { cause: Error; } +>cause : Error +>new Error("bar") : Error +>Error : ErrorConstructor +>"bar" : "bar" + diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json index 04e4b3ec22497..ed76bdb1760bc 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json @@ -139,5 +139,7 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json index 2a015c1fd8f13..7d2a5308b9e8b 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json @@ -133,5 +133,7 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js index 60a38d7286ed8..01d07f61429b4 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.error, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index ae0a1c21e43f8..4db9e7df4d352 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.error, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index ae0a1c21e43f8..4db9e7df4d352 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.error, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/cases/compiler/errorCause.ts b/tests/cases/compiler/errorCause.ts new file mode 100644 index 0000000000000..c04ce180bff35 --- /dev/null +++ b/tests/cases/compiler/errorCause.ts @@ -0,0 +1,3 @@ +// @target: es2021, es2022, esnext + +new Error("foo", { cause: new Error("bar") }); From 2c91268f398c0b29b5178cec1e3834c50eec4e62 Mon Sep 17 00:00:00 2001 From: Orta Date: Fri, 29 Oct 2021 10:30:23 +0100 Subject: [PATCH 9/9] Lint fix --- src/lib/es2022.error.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/es2022.error.d.ts b/src/lib/es2022.error.d.ts index 204c9e59d55e3..20927134e3536 100644 --- a/src/lib/es2022.error.d.ts +++ b/src/lib/es2022.error.d.ts @@ -1,8 +1,8 @@ -interface ErrorOptions { - cause?: Error; -} - -interface ErrorConstructor { - new(message?: string, options?: ErrorOptions): Error; - (message?: string, options?: ErrorOptions): Error; -} +interface ErrorOptions { + cause?: Error; +} + +interface ErrorConstructor { + new(message?: string, options?: ErrorOptions): Error; + (message?: string, options?: ErrorOptions): Error; +}