From 6f917c9560509ee76a864099c3ffb5c78270f4dd Mon Sep 17 00:00:00 2001 From: "K. Akatsuki" Date: Mon, 6 Sep 2021 17:50:25 -0400 Subject: [PATCH 1/2] Add Error causes --- src/compiler/commandLineParser.ts | 3 +- src/lib/esnext.d.ts | 1 + src/lib/esnext.error.d.ts | 68 +++++++++++++++++++++++++++++++ src/lib/libs.json | 1 + 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/lib/esnext.error.d.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 05d80d97ccc6e..f5f44d11c073b 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -78,7 +78,8 @@ namespace ts { ["esnext.bigint", "lib.es2020.bigint.d.ts"], ["esnext.string", "lib.es2021.string.d.ts"], ["esnext.promise", "lib.es2021.promise.d.ts"], - ["esnext.weakref", "lib.es2021.weakref.d.ts"] + ["esnext.weakref", "lib.es2021.weakref.d.ts"], + ["esnext.error", "lib.esnext.error.d.ts"] ]; /** diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index 4a3ac819c1900..aa900a4f94747 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -1,2 +1,3 @@ /// /// +/// diff --git a/src/lib/esnext.error.d.ts b/src/lib/esnext.error.d.ts new file mode 100644 index 0000000000000..41fa00f481db4 --- /dev/null +++ b/src/lib/esnext.error.d.ts @@ -0,0 +1,68 @@ +interface Error { + cause?: Error; +} + +interface ErrorOptions { + cause?: Error; +} + +interface ErrorConstructor { + new(message?: string, options?: ErrorOptions): Error; + (message?: string, options?: ErrorOptions): Error; +} + +interface EvalError extends Error { +} + +interface EvalErrorConstructor extends ErrorConstructor { + new(message?: string, options?: ErrorOptions): EvalError; + (message?: string, options?: ErrorOptions): EvalError; +} + +interface RangeError extends Error { +} + +interface RangeErrorConstructor extends ErrorConstructor { + new(message?: string, options?: ErrorOptions): RangeError; + (message?: string, options?: ErrorOptions): RangeError; +} + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor extends ErrorConstructor { + new(message?: string, options?: ErrorOptions): ReferenceError; + (message?: string, options?: ErrorOptions): ReferenceError; +} + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor extends ErrorConstructor { + new(message?: string, options?: ErrorOptions): SyntaxError; + (message?: string, options?: ErrorOptions): SyntaxError; +} + +interface TypeError extends Error { +} + +interface TypeErrorConstructor extends ErrorConstructor { + new(message?: string, options?: ErrorOptions): TypeError; + (message?: string, options?: ErrorOptions): TypeError; +} + +interface URIError extends Error { +} + +interface URIErrorConstructor extends ErrorConstructor { + new(message?: string, options?: ErrorOptions): URIError; + (message?: string, options?: ErrorOptions): URIError; +} + +interface AggregateError extends Error { +} + +interface AggregateErrorConstructor extends ErrorConstructor { + new(errors: Iterable, message?: string, options?: ErrorOptions): AggregateError; + (errors: Iterable, message?: string, options?: ErrorOptions): AggregateError; +} diff --git a/src/lib/libs.json b/src/lib/libs.json index 0eb3d7b657a34..1294effc4bcea 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -52,6 +52,7 @@ "es2021.promise", "es2021.weakref", "esnext.intl", + "esnext.error", // Default libraries "es5.full", "es2015.full", From eb53f1750ac0d6a57c57bb8198a91c07041577d7 Mon Sep 17 00:00:00 2001 From: Bread Date: Sun, 26 Sep 2021 16:09:57 -0400 Subject: [PATCH 2/2] update --lib messages --- .../does-not-add-color-when-NO_COLOR-is-set.js | 18 +++++++++--------- ...d-when-host-can't-provide-terminal-width.js | 18 +++++++++--------- ...Status.DiagnosticsPresent_OutputsSkipped.js | 18 +++++++++--------- 3 files changed, 27 insertions(+), 27 deletions(-) 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 339c4f290485a..e8ed2430d230e 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 @@ -1,11 +1,11 @@ -Input:: +Input:: //// [/lib/lib.d.ts] - - -Output:: -/lib/tsc + + +Output:: +/lib/tsc Version FakeTSVersion tsc: The TypeScript Compiler - Version FakeTSVersion @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext --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, 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, 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, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref, esnext.error --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. @@ -145,6 +145,6 @@ default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped - - +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + 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 02de5f847961e..455ca6bbd5f66 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 @@ -1,11 +1,11 @@ -Input:: +Input:: //// [/lib/lib.d.ts] - - -Output:: -/lib/tsc + + +Output:: +/lib/tsc Version FakeTSVersion tsc: The TypeScript Compiler - Version FakeTSVersion @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext --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, 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, 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, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref, esnext.error --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. @@ -145,6 +145,6 @@ default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped - - +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + 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 02de5f847961e..455ca6bbd5f66 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 @@ -1,11 +1,11 @@ -Input:: +Input:: //// [/lib/lib.d.ts] - - -Output:: -/lib/tsc + + +Output:: +/lib/tsc Version FakeTSVersion tsc: The TypeScript Compiler - Version FakeTSVersion @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext --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, 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, 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, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref, esnext.error --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. @@ -145,6 +145,6 @@ default: false You can learn about all of the compiler options at https://aka.ms/tsconfig-reference -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped - - +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + +