diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 09107e83df8..8ea829eaad5 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -223,7 +223,7 @@ namespace ts { type: "boolean", showInSimplifiedHelpView: true, category: Diagnostics.Output_Formatting, - description: Diagnostics.Enable_color_and_formatting_in_output_to_make_compiler_errors_easier_to_read, + description: Diagnostics.Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read, defaultValueDescription: "true" }, { @@ -553,7 +553,7 @@ namespace ts { type: "boolean", showInSimplifiedHelpView: true, category: Diagnostics.Emit, - description: Diagnostics.Disable_emitting_file_from_a_compilation, + description: Diagnostics.Disable_emitting_files_from_a_compilation, transpileOptionValue: undefined, defaultValueDescription: "false" }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 46d28a46901..fcc8813a007 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5459,7 +5459,7 @@ "category": "Message", "code": 6659 }, - "Disable emitting file from a compilation.": { + "Disable emitting files from a compilation.": { "category": "Message", "code": 6660 }, @@ -5559,7 +5559,7 @@ "category": "Message", "code": 6684 }, - "Enable color and formatting in output to make compiler errors easier to read": { + "Enable color and formatting in TypeScript's output to make compiler errors easier to read": { "category": "Message", "code": 6685 }, @@ -5788,7 +5788,7 @@ "category": "Message", "code": 6923 }, - "Ignoring tsconfig.json, compiles the specified files with default compiler options": { + "Ignoring tsconfig.json, compiles the specified files with default compiler options.": { "category": "Message", "code": 6924 }, @@ -5800,7 +5800,7 @@ "category": "Message", "code": 6926 }, - "Compiles the TypeScript project located at the specified path": { + "Compiles the TypeScript project located at the specified path.": { "category": "Message", "code": 6927 }, @@ -5808,7 +5808,7 @@ "category": "Message", "code": 6928 }, - "Compiles the current project, with additional settings": { + "Compiles the current project, with additional settings.": { "category": "Message", "code": 6929 }, diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 888172b8732..87084d4f4bb 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -68,7 +68,7 @@ namespace ts { } function defaultIsPretty(sys: System) { - return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY(); + return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY() && !sys.getEnvironmentVariable("NO_COLOR"); } function shouldBePretty(sys: System, options: CompilerOptions | BuildOptions) { @@ -96,26 +96,47 @@ namespace ts { bold: (str: string) => str, blue: (str: string) => str, blueBackground: (str: string) => str, - white: (str: string) => str + brightWhite: (str: string) => str }; } function bold(str: string) { return `\x1b[1m${str}\x1b[22m`; } + + const isWindows = sys.getEnvironmentVariable("OS") && stringContains(sys.getEnvironmentVariable("OS").toLowerCase(), "windows"); + const isWindowsTerminal = sys.getEnvironmentVariable("WT_SESSION"); + const isVSCode = sys.getEnvironmentVariable("TERM_PROGRAM") && sys.getEnvironmentVariable("TERM_PROGRAM") === "vscode"; + function blue(str: string) { - return `\x1b[34m${str}\x1b[39m`; + // Effectively Powershell and Command prompt users use cyan instead + // of blue because the default theme doesn't show blue with enough contrast. + if (isWindows && !isWindowsTerminal && !isVSCode) { + return brightWhite(str); + } + + return `\x1b[94m${str}\x1b[39m`; } + + // There are ~3 types of terminal color support: 16 colors, 256 and 16m colors + // If there is richer color support, e.g. 256+ we can use extended ANSI codes which are not just generic 'blue' + // but a 'lighter blue' which is closer to the blue in the TS logo. + const supportsRicherColors = sys.getEnvironmentVariable("COLORTERM") === "truecolor" || sys.getEnvironmentVariable("TERM") === "xterm-256color"; function blueBackground(str: string) { - return `\x1b[44m${str}\x1b[49m`; + if (supportsRicherColors) { + return `\x1B[48;5;68m${str}\x1B[39;49m`; + } + else { + return `\x1b[44m${str}\x1B[39;49m`; + } } - function white(str: string) { - return `\x1b[37m${str}\x1b[39m`; + function brightWhite(str: string) { + return `\x1b[97m${str}\x1b[39m`; } return { bold, blue, - white, + brightWhite, blueBackground }; } @@ -143,7 +164,7 @@ namespace ts { const terminalWidth = sys.getWidthOfTerminal?.() ?? 0; // Note: child_process might return `terminalWidth` as undefined. - if (terminalWidth >= 60) { + if (terminalWidth >= 80) { let description = ""; if (option.description) { description = getDiagnosticText(option.description); @@ -340,7 +361,7 @@ namespace ts { example("tsc app.ts util.ts", Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options); example("tsc -b", Diagnostics.Build_a_composite_project_in_the_working_directory); example("tsc --init", Diagnostics.Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory); - example("tsc -p .path/to/tsconfig.json", Diagnostics.Compiles_the_TypeScript_project_located_at_the_specified_path); + example("tsc -p ./path/to/tsconfig.json", Diagnostics.Compiles_the_TypeScript_project_located_at_the_specified_path); example("tsc --help --all", Diagnostics.An_expanded_version_of_this_information_showing_all_possible_compiler_options); example(["tsc --noEmit", "tsc --target esnext"], Diagnostics.Compiles_the_current_project_with_additional_settings); @@ -392,7 +413,7 @@ namespace ts { const tsIconLength = 5; const tsIconFirstLine = colors.blueBackground(padLeft("", tsIconLength)); - const tsIconSecondLine = colors.blueBackground(colors.white(padLeft("TS ", tsIconLength))); + const tsIconSecondLine = colors.blueBackground(colors.brightWhite(padLeft("TS ", tsIconLength))); // If we have enough space, print TS icon. if (terminalWidth >= tscExplanation.length + tsIconLength) { // right align of the icon is 120 at most. diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index d09ffec78f9..1c4a3c9a0a4 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -14,5 +14,14 @@ namespace ts { fs: () => loadProjectFromFiles({}), commandLineArgs: [], }); + + verifyTsc({ + scenario: "runWithoutArgs", + subScenario: "does not add color when NO_COLOR is set", + fs: () => loadProjectFromFiles({}), + commandLineArgs: [], + environmentVariables: { NO_COLOR: "true" } + }); + }); } diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index a936136ad6a..83b5f57342d 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 909d91ad019..2be01ddc518 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 940e1d42111..01694c43ef3 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 9e5b2f31468..14e69415419 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index 5553575444d..4c6956b7823 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 6b2e1264011..22622f8c574 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index a936136ad6a..83b5f57342d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 21798af11aa..9d936c92387 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index f9f3d275cf3..098547e332c 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -49,7 +49,7 @@ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 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 new file mode 100644 index 00000000000..339c4f29048 --- /dev/null +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js @@ -0,0 +1,150 @@ +Input:: +//// [/lib/lib.d.ts] + + + + +Output:: +/lib/tsc +Version FakeTSVersion +tsc: The TypeScript Compiler - Version FakeTSVersion + +COMMON COMMANDS + + tsc + Compiles the current project (tsconfig.json in the working directory.) + + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options. + + tsc -b + Build a composite project in the working directory. + + tsc --init + Creates a tsconfig.json with the recommended settings in the working directory. + + tsc -p ./path/to/tsconfig.json + Compiles the TypeScript project located at the specified path. + + tsc --help --all + An expanded version of this information, showing all possible compiler options + + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings. + +COMMAND LINE FLAGS + +--help, -h +Print this message. + +--watch, -w +Watch input files. + +--all +Show all compiler options. + +--version, -v +Print the compiler's version. + +--init +Initializes a TypeScript project and creates a tsconfig.json file. + +--project, -p +Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. + +--build, -b +Build one or more projects and their dependencies, if out of date + +--showConfig +Print the final configuration instead of building. + +COMMON COMPILER OPTIONS + +--pretty +Enable color and formatting in TypeScript's output to make compiler errors easier to read +type: boolean +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 +default: ES3 + +--module, -m +Specify what module code is generated. +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 + +--allowJs +Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. +type: boolean +default: false + +--checkJs +Enable error reporting in type-checked JavaScript files. +type: boolean +default: false + +--jsx +Specify what JSX code is generated. +one of: preserve, react-native, react, react-jsx, react-jsxdev +default: undefined + +--declaration, -d +Generate .d.ts files from TypeScript and JavaScript files in your project. +type: boolean +default: `false`, unless `composite` is set + +--declarationMap +Create sourcemaps for d.ts files. +type: boolean +default: false + +--emitDeclarationOnly +Only output d.ts files and not JavaScript files. +type: boolean +default: false + +--sourceMap +Create source map files for emitted JavaScript files. +type: boolean +default: false + +--outFile +Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. + +--outDir +Specify an output folder for all emitted files. + +--removeComments +Disable emitting comments. +type: boolean +default: false + +--noEmit +Disable emitting files from a compilation. +type: boolean +default: false + +--strict +Enable all strict type-checking options. +type: boolean +default: false + +--types +Specify type package names to be included without being referenced in a source file. + +--esModuleInterop +Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. +type: boolean +default: false + +You can learn about all of the compiler options at https://aka.ms/tsconfig-reference + +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 d58956b4597..02de5f84796 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 @@ -11,134 +11,134 @@ tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS - tsc + tsc Compiles the current project (tsconfig.json in the working directory.) - tsc app.ts util.ts - Ignoring tsconfig.json, compiles the specified files with default compiler options + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options. - tsc -b + tsc -b Build a composite project in the working directory. - tsc --init + tsc --init Creates a tsconfig.json with the recommended settings in the working directory. - tsc -p .path/to/tsconfig.json - Compiles the TypeScript project located at the specified path + tsc -p ./path/to/tsconfig.json + Compiles the TypeScript project located at the specified path. - tsc --help --all + tsc --help --all An expanded version of this information, showing all possible compiler options - tsc --noEmit - tsc --target esnext - Compiles the current project, with additional settings + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings. COMMAND LINE FLAGS ---help, -h +--help, -h Print this message. ---watch, -w +--watch, -w Watch input files. ---all +--all Show all compiler options. ---version, -v +--version, -v Print the compiler's version. ---init +--init Initializes a TypeScript project and creates a tsconfig.json file. ---project, -p +--project, -p Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. ---build, -b +--build, -b Build one or more projects and their dependencies, if out of date ---showConfig +--showConfig Print the final configuration instead of building. COMMON COMPILER OPTIONS ---pretty -Enable color and formatting in output to make compiler errors easier to read +--pretty +Enable color and formatting in TypeScript's output to make compiler errors easier to read type: boolean default: true ---target, -t +--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 default: ES3 ---module, -m +--module, -m Specify what module code is generated. one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext ---lib +--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 ---allowJs +--allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. type: boolean default: false ---checkJs +--checkJs Enable error reporting in type-checked JavaScript files. type: boolean default: false ---jsx +--jsx Specify what JSX code is generated. one of: preserve, react-native, react, react-jsx, react-jsxdev default: undefined ---declaration, -d +--declaration, -d Generate .d.ts files from TypeScript and JavaScript files in your project. type: boolean default: `false`, unless `composite` is set ---declarationMap +--declarationMap Create sourcemaps for d.ts files. type: boolean default: false ---emitDeclarationOnly +--emitDeclarationOnly Only output d.ts files and not JavaScript files. type: boolean default: false ---sourceMap +--sourceMap Create source map files for emitted JavaScript files. type: boolean default: false ---outFile +--outFile Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. ---outDir +--outDir Specify an output folder for all emitted files. ---removeComments +--removeComments Disable emitting comments. type: boolean default: false ---noEmit -Disable emitting file from a compilation. +--noEmit +Disable emitting files from a compilation. type: boolean default: false ---strict +--strict Enable all strict type-checking options. type: boolean default: false ---types +--types Specify type package names to be included without being referenced in a source file. ---esModuleInterop +--esModuleInterop Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. type: boolean default: false 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 d58956b4597..02de5f84796 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 @@ -11,134 +11,134 @@ tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS - tsc + tsc Compiles the current project (tsconfig.json in the working directory.) - tsc app.ts util.ts - Ignoring tsconfig.json, compiles the specified files with default compiler options + tsc app.ts util.ts + Ignoring tsconfig.json, compiles the specified files with default compiler options. - tsc -b + tsc -b Build a composite project in the working directory. - tsc --init + tsc --init Creates a tsconfig.json with the recommended settings in the working directory. - tsc -p .path/to/tsconfig.json - Compiles the TypeScript project located at the specified path + tsc -p ./path/to/tsconfig.json + Compiles the TypeScript project located at the specified path. - tsc --help --all + tsc --help --all An expanded version of this information, showing all possible compiler options - tsc --noEmit - tsc --target esnext - Compiles the current project, with additional settings + tsc --noEmit + tsc --target esnext + Compiles the current project, with additional settings. COMMAND LINE FLAGS ---help, -h +--help, -h Print this message. ---watch, -w +--watch, -w Watch input files. ---all +--all Show all compiler options. ---version, -v +--version, -v Print the compiler's version. ---init +--init Initializes a TypeScript project and creates a tsconfig.json file. ---project, -p +--project, -p Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'. ---build, -b +--build, -b Build one or more projects and their dependencies, if out of date ---showConfig +--showConfig Print the final configuration instead of building. COMMON COMPILER OPTIONS ---pretty -Enable color and formatting in output to make compiler errors easier to read +--pretty +Enable color and formatting in TypeScript's output to make compiler errors easier to read type: boolean default: true ---target, -t +--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 default: ES3 ---module, -m +--module, -m Specify what module code is generated. one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext ---lib +--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 ---allowJs +--allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. type: boolean default: false ---checkJs +--checkJs Enable error reporting in type-checked JavaScript files. type: boolean default: false ---jsx +--jsx Specify what JSX code is generated. one of: preserve, react-native, react, react-jsx, react-jsxdev default: undefined ---declaration, -d +--declaration, -d Generate .d.ts files from TypeScript and JavaScript files in your project. type: boolean default: `false`, unless `composite` is set ---declarationMap +--declarationMap Create sourcemaps for d.ts files. type: boolean default: false ---emitDeclarationOnly +--emitDeclarationOnly Only output d.ts files and not JavaScript files. type: boolean default: false ---sourceMap +--sourceMap Create source map files for emitted JavaScript files. type: boolean default: false ---outFile +--outFile Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. ---outDir +--outDir Specify an output folder for all emitted files. ---removeComments +--removeComments Disable emitting comments. type: boolean default: false ---noEmit -Disable emitting file from a compilation. +--noEmit +Disable emitting files from a compilation. type: boolean default: false ---strict +--strict Enable all strict type-checking options. type: boolean default: false ---types +--types Specify type package names to be included without being referenced in a source file. ---esModuleInterop +--esModuleInterop Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. type: boolean default: false diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js index ffde45ed51c..818d097a271 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -70,7 +70,7 @@ interface Array { length: number; [n: number]: T; } // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js index 7d8c7dc00f4..a24e27e79b3 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -70,7 +70,7 @@ interface Array { length: number; [n: number]: T; } // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ "outDir": "build", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js index 2339452e2ba..5854bd52724 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -70,7 +70,7 @@ interface Array { length: number; [n: number]: T; } // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ "outDir": "build", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js index b28214cfa6f..5273f50ea2f 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -70,7 +70,7 @@ interface Array { length: number; [n: number]: T; } "outFile": "build/outFile.js", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js index 9c9e53d029c..79033fbaea3 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js @@ -70,7 +70,7 @@ interface Array { length: number; [n: number]: T; } // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js index 0415e06b6f3..2ad1060ce70 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -70,7 +70,7 @@ interface Array { length: number; [n: number]: T; } // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ // "outDir": "./", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting file from a compilation. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */