diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index ade646ba086d0..708afb5e878b2 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -534,6 +534,7 @@ export const targetOptionDeclaration: CommandLineOptionOfCustomType = { es2020: ScriptTarget.ES2020, es2021: ScriptTarget.ES2021, es2022: ScriptTarget.ES2022, + es2023: ScriptTarget.ES2023, esnext: ScriptTarget.ESNext, })), affectsSourceFile: true, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index fead20508c55b..44482247f7cf2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7362,6 +7362,7 @@ export const enum ScriptTarget { ES2020 = 7, ES2021 = 8, ES2022 = 9, + ES2023 = 10, ESNext = 99, JSON = 100, Latest = ESNext, diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 328e1b2f0e55c..60e19b0e4708a 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -311,6 +311,8 @@ export function getDefaultLibFileName(options: CompilerOptions): string { switch (getEmitScriptTarget(options)) { case ScriptTarget.ESNext: return "lib.esnext.full.d.ts"; + case ScriptTarget.ES2023: + return "lib.es2023.full.d.ts"; case ScriptTarget.ES2022: return "lib.es2022.full.d.ts"; case ScriptTarget.ES2021: diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 8cf19bdb97616..b27fb4d5c3dc1 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -3142,6 +3142,7 @@ export const enum ScriptTarget { ES2020 = "es2020", ES2021 = "es2021", ES2022 = "es2022", + ES2023 = "es2023", ESNext = "esnext", JSON = "json", Latest = ESNext, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index c37b96382f606..73042d5ee083f 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2416,6 +2416,7 @@ declare namespace ts { ES2020 = "es2020", ES2021 = "es2021", ES2022 = "es2022", + ES2023 = "es2023", ESNext = "esnext", JSON = "json", Latest = "esnext", @@ -7019,6 +7020,7 @@ declare namespace ts { ES2020 = 7, ES2021 = 8, ES2022 = 9, + ES2023 = 10, ESNext = 99, JSON = 100, Latest = 99, diff --git a/tests/baselines/reference/callChainWithSuper(target=es2023).js b/tests/baselines/reference/callChainWithSuper(target=es2023).js new file mode 100644 index 0000000000000..96be01245bfa7 --- /dev/null +++ b/tests/baselines/reference/callChainWithSuper(target=es2023).js @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/expressions/optionalChaining/callChain/callChainWithSuper.ts] //// + +//// [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/config/commandLineParsing/parseCommandLine/Parse empty options of --target.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --target.js index 315e2343c7e98..149d87a41590c 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --target.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --target.js @@ -7,4 +7,4 @@ FileNames:: 0.ts Errors:: error TS6044: Compiler option 'target' expects an argument. -error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'. +error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with json api.js index 57c0d1a0336c3..9fd42f9dccca1 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with json api.js @@ -23,5 +23,5 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'. +error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with jsonSourceFile api.js index 69558be1110af..a2a5236b42000 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of target to compiler-options with jsonSourceFile api.js @@ -23,7 +23,7 @@ CompilerOptions:: "configFilePath": "tsconfig.json" } Errors:: -tsconfig.json:3:15 - error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'. +tsconfig.json:3:15 - error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext'. 3 "target": "",    ~~ diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert tsconfig options when there are multiple invalid strings with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert tsconfig options when there are multiple invalid strings with jsonSourceFile api.js index 009f13cf4e714..81ebc6dffec5a 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert tsconfig options when there are multiple invalid strings with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert tsconfig options when there are multiple invalid strings with jsonSourceFile api.js @@ -47,7 +47,7 @@ Errors::   ~~~  19 }   ~ -tsconfig.json:3:15 - error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'. +tsconfig.json:3:15 - error TS6046: Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'esnext'. 3 "target": "<%- options.useTsWithBabel ? 'esnext' : 'es5' %>",    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js index 0da50d90ce6d0..97c9057dd03b3 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js @@ -101,7 +101,7 @@ default: false --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext +one of: es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext default: es5 --module, -m diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 948f93ad35f21..8191f56bbf51a 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -101,7 +101,7 @@ default: false --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext +one of: es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext default: es5 --module, -m diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 948f93ad35f21..8191f56bbf51a 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -101,7 +101,7 @@ default: false --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext +one of: es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext default: es5 --module, -m