Revisions for the new --help (#44800)
* WIP on refining the new --help * Fix types in the boolean trivial lint rule * Update baselines * More work * Updates the color logic * Simplifies the CLI color code * Use cyan instead of blue for win powershell/command prompt * Use bright white when blue is probably going to look off * Fix NO_COLOR * Adds a test to cover NO_COLOR * Update src/compiler/diagnosticMessages.json Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com> * Update compiler diagnostic text Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
This commit is contained in:
parent
635f5bdf8c
commit
1f85123821
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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
|
||||
},
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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" }
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
@ -11,134 +11,134 @@ tsc: The TypeScript Compiler - Version FakeTSVersion
|
|||
|
||||
[1mCOMMON COMMANDS[22m
|
||||
|
||||
[34mtsc[39m
|
||||
[94mtsc[39m
|
||||
Compiles the current project (tsconfig.json in the working directory.)
|
||||
|
||||
[34mtsc app.ts util.ts[39m
|
||||
Ignoring tsconfig.json, compiles the specified files with default compiler options
|
||||
[94mtsc app.ts util.ts[39m
|
||||
Ignoring tsconfig.json, compiles the specified files with default compiler options.
|
||||
|
||||
[34mtsc -b[39m
|
||||
[94mtsc -b[39m
|
||||
Build a composite project in the working directory.
|
||||
|
||||
[34mtsc --init[39m
|
||||
[94mtsc --init[39m
|
||||
Creates a tsconfig.json with the recommended settings in the working directory.
|
||||
|
||||
[34mtsc -p .path/to/tsconfig.json[39m
|
||||
Compiles the TypeScript project located at the specified path
|
||||
[94mtsc -p ./path/to/tsconfig.json[39m
|
||||
Compiles the TypeScript project located at the specified path.
|
||||
|
||||
[34mtsc --help --all[39m
|
||||
[94mtsc --help --all[39m
|
||||
An expanded version of this information, showing all possible compiler options
|
||||
|
||||
[34mtsc --noEmit[39m
|
||||
[34mtsc --target esnext[39m
|
||||
Compiles the current project, with additional settings
|
||||
[94mtsc --noEmit[39m
|
||||
[94mtsc --target esnext[39m
|
||||
Compiles the current project, with additional settings.
|
||||
|
||||
[1mCOMMAND LINE FLAGS[22m
|
||||
|
||||
[34m--help, -h[39m
|
||||
[94m--help, -h[39m
|
||||
Print this message.
|
||||
|
||||
[34m--watch, -w[39m
|
||||
[94m--watch, -w[39m
|
||||
Watch input files.
|
||||
|
||||
[34m--all[39m
|
||||
[94m--all[39m
|
||||
Show all compiler options.
|
||||
|
||||
[34m--version, -v[39m
|
||||
[94m--version, -v[39m
|
||||
Print the compiler's version.
|
||||
|
||||
[34m--init[39m
|
||||
[94m--init[39m
|
||||
Initializes a TypeScript project and creates a tsconfig.json file.
|
||||
|
||||
[34m--project, -p[39m
|
||||
[94m--project, -p[39m
|
||||
Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.
|
||||
|
||||
[34m--build, -b[39m
|
||||
[94m--build, -b[39m
|
||||
Build one or more projects and their dependencies, if out of date
|
||||
|
||||
[34m--showConfig[39m
|
||||
[94m--showConfig[39m
|
||||
Print the final configuration instead of building.
|
||||
|
||||
[1mCOMMON COMPILER OPTIONS[22m
|
||||
|
||||
[34m--pretty[39m
|
||||
Enable color and formatting in output to make compiler errors easier to read
|
||||
[94m--pretty[39m
|
||||
Enable color and formatting in TypeScript's output to make compiler errors easier to read
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
[34m--target, -t[39m
|
||||
[94m--target, -t[39m
|
||||
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
|
||||
|
||||
[34m--module, -m[39m
|
||||
[94m--module, -m[39m
|
||||
Specify what module code is generated.
|
||||
one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext
|
||||
|
||||
[34m--lib[39m
|
||||
[94m--lib[39m
|
||||
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
|
||||
|
||||
[34m--allowJs[39m
|
||||
[94m--allowJs[39m
|
||||
Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--checkJs[39m
|
||||
[94m--checkJs[39m
|
||||
Enable error reporting in type-checked JavaScript files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--jsx[39m
|
||||
[94m--jsx[39m
|
||||
Specify what JSX code is generated.
|
||||
one of: preserve, react-native, react, react-jsx, react-jsxdev
|
||||
default: undefined
|
||||
|
||||
[34m--declaration, -d[39m
|
||||
[94m--declaration, -d[39m
|
||||
Generate .d.ts files from TypeScript and JavaScript files in your project.
|
||||
type: boolean
|
||||
default: `false`, unless `composite` is set
|
||||
|
||||
[34m--declarationMap[39m
|
||||
[94m--declarationMap[39m
|
||||
Create sourcemaps for d.ts files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--emitDeclarationOnly[39m
|
||||
[94m--emitDeclarationOnly[39m
|
||||
Only output d.ts files and not JavaScript files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--sourceMap[39m
|
||||
[94m--sourceMap[39m
|
||||
Create source map files for emitted JavaScript files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--outFile[39m
|
||||
[94m--outFile[39m
|
||||
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.
|
||||
|
||||
[34m--outDir[39m
|
||||
[94m--outDir[39m
|
||||
Specify an output folder for all emitted files.
|
||||
|
||||
[34m--removeComments[39m
|
||||
[94m--removeComments[39m
|
||||
Disable emitting comments.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--noEmit[39m
|
||||
Disable emitting file from a compilation.
|
||||
[94m--noEmit[39m
|
||||
Disable emitting files from a compilation.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--strict[39m
|
||||
[94m--strict[39m
|
||||
Enable all strict type-checking options.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--types[39m
|
||||
[94m--types[39m
|
||||
Specify type package names to be included without being referenced in a source file.
|
||||
|
||||
[34m--esModuleInterop[39m
|
||||
[94m--esModuleInterop[39m
|
||||
Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.
|
||||
type: boolean
|
||||
default: false
|
||||
|
|
|
@ -11,134 +11,134 @@ tsc: The TypeScript Compiler - Version FakeTSVersion
|
|||
|
||||
[1mCOMMON COMMANDS[22m
|
||||
|
||||
[34mtsc[39m
|
||||
[94mtsc[39m
|
||||
Compiles the current project (tsconfig.json in the working directory.)
|
||||
|
||||
[34mtsc app.ts util.ts[39m
|
||||
Ignoring tsconfig.json, compiles the specified files with default compiler options
|
||||
[94mtsc app.ts util.ts[39m
|
||||
Ignoring tsconfig.json, compiles the specified files with default compiler options.
|
||||
|
||||
[34mtsc -b[39m
|
||||
[94mtsc -b[39m
|
||||
Build a composite project in the working directory.
|
||||
|
||||
[34mtsc --init[39m
|
||||
[94mtsc --init[39m
|
||||
Creates a tsconfig.json with the recommended settings in the working directory.
|
||||
|
||||
[34mtsc -p .path/to/tsconfig.json[39m
|
||||
Compiles the TypeScript project located at the specified path
|
||||
[94mtsc -p ./path/to/tsconfig.json[39m
|
||||
Compiles the TypeScript project located at the specified path.
|
||||
|
||||
[34mtsc --help --all[39m
|
||||
[94mtsc --help --all[39m
|
||||
An expanded version of this information, showing all possible compiler options
|
||||
|
||||
[34mtsc --noEmit[39m
|
||||
[34mtsc --target esnext[39m
|
||||
Compiles the current project, with additional settings
|
||||
[94mtsc --noEmit[39m
|
||||
[94mtsc --target esnext[39m
|
||||
Compiles the current project, with additional settings.
|
||||
|
||||
[1mCOMMAND LINE FLAGS[22m
|
||||
|
||||
[34m--help, -h[39m
|
||||
[94m--help, -h[39m
|
||||
Print this message.
|
||||
|
||||
[34m--watch, -w[39m
|
||||
[94m--watch, -w[39m
|
||||
Watch input files.
|
||||
|
||||
[34m--all[39m
|
||||
[94m--all[39m
|
||||
Show all compiler options.
|
||||
|
||||
[34m--version, -v[39m
|
||||
[94m--version, -v[39m
|
||||
Print the compiler's version.
|
||||
|
||||
[34m--init[39m
|
||||
[94m--init[39m
|
||||
Initializes a TypeScript project and creates a tsconfig.json file.
|
||||
|
||||
[34m--project, -p[39m
|
||||
[94m--project, -p[39m
|
||||
Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.
|
||||
|
||||
[34m--build, -b[39m
|
||||
[94m--build, -b[39m
|
||||
Build one or more projects and their dependencies, if out of date
|
||||
|
||||
[34m--showConfig[39m
|
||||
[94m--showConfig[39m
|
||||
Print the final configuration instead of building.
|
||||
|
||||
[1mCOMMON COMPILER OPTIONS[22m
|
||||
|
||||
[34m--pretty[39m
|
||||
Enable color and formatting in output to make compiler errors easier to read
|
||||
[94m--pretty[39m
|
||||
Enable color and formatting in TypeScript's output to make compiler errors easier to read
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
[34m--target, -t[39m
|
||||
[94m--target, -t[39m
|
||||
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
|
||||
|
||||
[34m--module, -m[39m
|
||||
[94m--module, -m[39m
|
||||
Specify what module code is generated.
|
||||
one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext
|
||||
|
||||
[34m--lib[39m
|
||||
[94m--lib[39m
|
||||
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
|
||||
|
||||
[34m--allowJs[39m
|
||||
[94m--allowJs[39m
|
||||
Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--checkJs[39m
|
||||
[94m--checkJs[39m
|
||||
Enable error reporting in type-checked JavaScript files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--jsx[39m
|
||||
[94m--jsx[39m
|
||||
Specify what JSX code is generated.
|
||||
one of: preserve, react-native, react, react-jsx, react-jsxdev
|
||||
default: undefined
|
||||
|
||||
[34m--declaration, -d[39m
|
||||
[94m--declaration, -d[39m
|
||||
Generate .d.ts files from TypeScript and JavaScript files in your project.
|
||||
type: boolean
|
||||
default: `false`, unless `composite` is set
|
||||
|
||||
[34m--declarationMap[39m
|
||||
[94m--declarationMap[39m
|
||||
Create sourcemaps for d.ts files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--emitDeclarationOnly[39m
|
||||
[94m--emitDeclarationOnly[39m
|
||||
Only output d.ts files and not JavaScript files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--sourceMap[39m
|
||||
[94m--sourceMap[39m
|
||||
Create source map files for emitted JavaScript files.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--outFile[39m
|
||||
[94m--outFile[39m
|
||||
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.
|
||||
|
||||
[34m--outDir[39m
|
||||
[94m--outDir[39m
|
||||
Specify an output folder for all emitted files.
|
||||
|
||||
[34m--removeComments[39m
|
||||
[94m--removeComments[39m
|
||||
Disable emitting comments.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--noEmit[39m
|
||||
Disable emitting file from a compilation.
|
||||
[94m--noEmit[39m
|
||||
Disable emitting files from a compilation.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--strict[39m
|
||||
[94m--strict[39m
|
||||
Enable all strict type-checking options.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
[34m--types[39m
|
||||
[94m--types[39m
|
||||
Specify type package names to be included without being referenced in a source file.
|
||||
|
||||
[34m--esModuleInterop[39m
|
||||
[94m--esModuleInterop[39m
|
||||
Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.
|
||||
type: boolean
|
||||
default: false
|
||||
|
|
|
@ -70,7 +70,7 @@ interface Array<T> { 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. */
|
||||
|
|
|
@ -70,7 +70,7 @@ interface Array<T> { 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. */
|
||||
|
|
|
@ -70,7 +70,7 @@ interface Array<T> { 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. */
|
||||
|
|
|
@ -70,7 +70,7 @@ interface Array<T> { 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. */
|
||||
|
|
|
@ -70,7 +70,7 @@ interface Array<T> { 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. */
|
||||
|
|
|
@ -70,7 +70,7 @@ interface Array<T> { 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. */
|
||||
|
|
Loading…
Reference in a new issue