Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

TypeScript compilation options


May 07, 2021 TypeScript


Table of contents


TypeScript compilation options

Compilation options

Options Type The default Describe
--allowJs boolean true Allows javascript files to be compiled.
--allowSyntheticDefaultImports boolean module === "system" Allows the default import from modules that do not have a default export set. This does not affect the display of the code, only the type check.
--allowUnreachableCode boolean false Code errors that are not executed are not reported.
--allowUnusedLabels boolean false Unused label errors are not reported.
--baseUrl string Resolves the baseline directory that is not relative to the module name. View the module resolution documentation for details.
--charset string "utf8" Enter the character set of the file.
--declaration
-d
boolean false Generate the appropriate '.d.ts' file.
--declarationDir string The output path that generates the claim file.
--diagnostics boolean false Show diagnostic information.
--disableSizeLimit boolean false Disable the JavaScript project volume limit
--emitBOM boolean false Add a BOM header (UTF-8 Byte Order Mark) at the beginning of the output file.
--emitDecoratorMetadata [1] boolean false Add design type metadata to the decorator declaration in the source code. Check out the #2577 for more information.
--experimentalDecorators [1] boolean false Experimentally enable ES7 decorator support.
--forceConsistentCasingInFileNames boolean false Inconsistent wrappers are not allowed to reference the same file.
--help
-h
Print help information.
--inlineSourceMap boolean false Instead of generating a single sourcemaps file, you will generate a different file for each sourcemaps.
--inlineSources boolean false Generating the code into a file with sourcemaps requires that the --inlineSourceMap be set --sourceMap time.
--init Initialize the TypeScript project and create a tsconfig.json file.
--isolatedModules boolean false Generate imports unconditionally for files that are not resolved.
--jsx string "Preserve" Support for JSX: 'React' or 'Preserve' in the '.tsx' file. View JSX.
--lib string[] A list of library files that need to be introduced during compilation.
Possible values are:
es5
es6
es2015
es7
es2016
es2017 dom webworker 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
Note: If --lib specify a default library. The default library is
► For --target ES5: dom,es5,scripthost
► For --target ES6: dom,es6,dom.iterable,scripthost
--listEmittedFiles boolean false Print out the name of the compiled generated file.
--listFiles boolean false The file name is printed during compilation.
--locale string (platform specific) The language in which the error message is displayed, such as en-us.
--mapRoot string Specify the path to the sourcemap file for the debugger instead of using the path at the time of the build. U se this tag when the .map file is specified at runtime and is different from the address of the js file. The specified path is embedded sourceMap tell the debugger where to find them.
--maxNodeModuleJsDepth number 0 node_modules the most dependent on deep search and loading JavaScript files. Available only --allowJs
--module
-m
string target === 'ES6' ? 'ES6' : 'commonjs' Specify which module system code to generate: 'commonjs', 'amd', 'system', or 'umd' or 'es2015'. O nly 'amd' and 'system' can --outFile 'es2015' cannot be used when the target is ES5 or below.
--moduleResolution string module === 'amd' | 'system' | 'ES6' ? 'classic' : 'node' Decide what to do with the module. E ither 'node' is .js/io .js or 'classic' (default). View the module resolution documentation for details.
--newLine string (platform specific) Specify the line end character: 'CRLF' (dos) or 'LF' (unix) when the file is generated.
--noEmit boolean false The output file is not generated.
--noEmitHelpers boolean false Do not generate user-defined help function code in the output file, __extends
--noEmitOnError boolean false The output file is not generated when an error is reported.
--noFallthroughCasesInSwitch boolean false The fallthrough error that reports the switch statement. (i.e., the case statement of switch is not allowed to run through)
--noImplicitAny boolean false There is an implicit 'any' type of error in expressions and declarations.
--noImplicitReturns boolean false Not all return paths of the function have return values that are mis-reported.
--noImplicitThis boolean false When this of this expression is any type, an error is generated.
--noImplicitUseStrict boolean false The 'use strict' instruction is not included in the module output.
--noLib boolean false Does not contain the default library file (lib.d.ts).
--noResolve boolean false Do not /// <reference``> or module to the list of compiled files.
--noUnusedLocals boolean false If there are unused local variables, they are thrown wrong.
--noUnusedParameters boolean false If there are unused parameters thrown wrong.
--out string Deprecated. Use --outFile
--outDir string Redirect the output directory.
--outFile string Combine the output files into one file. T he order of the merges is determined based on the order of the files passed in to the compiler and the order of the files of ///<reference``> and import View the output file order file for details.
paths [2] Object A list of module names baseUrl path maps. View the module resolution documentation for details.
--preserveConstEnums boolean false The const enum retained. Check out the const enums documentation for more information.
--pretty [1] boolean false Style errors and messages, using colors and contexts.
--project
-p
string Compile the items in the specified directory. T his directory should contain a tsconfig.json to manage compilation. Check out the tsconfig.json documentation for more information.
--reactNamespace string "React" When the target is to generate 'react' JSX, specify the call __spread createElement and the file
--removeComments boolean false Delete all comments except copyright information that begins with /!*
--rootDir string (common root directory is computed from the list of input files) The directory structure used only to control the --outDir
rootDirs [2] string[] A list of root folders that are linked to the contents of the engineering structure that the representative is running to represent. View the module resolution documentation for details.
--skipLibCheck boolean false The correctness of the default library lib.d.ts is not checked.
--skipDefaultLibCheck boolean false Do not check the correctness of *.d.ts
--sourceMap boolean false Generate the appropriate '.map' file.
--sourceRoot string Specify the path to the TypeScript source file for the debugger to locate. U se this tag when the location of the TypeScript file is specified at runtime. Path information is added sourceMap
--strictNullChecks boolean false In strict null mode, null and undefined any type and are only allowed any and any (with one exception, undefined assigned to void
--stripInternal [1] boolean false Code is /** @internal */ annotations.
--suppressExcessPropertyErrors [1] boolean false Blocks additional property checks on the literal amount of the object.
--suppressImplicitAnyIndexErrors boolean false Block --noImplicitAny errors to index objects that lack index signatures. Check out the #1232 to learn more.
--target
-t
string "ES5" Specify ECMAScript target versions 'ES3' (default), 'ES5', or 'ES6'
--traceResolution boolean false The build module resolves the log information
--types string[] The list of type declaration file names to include.
--typeRoots string[] The list of type declaration file paths to include.
--version
-v
Print the compiler version number.
--watch
-w
Run the compiler in monitoring mode. The output files are monitored and recompiled as they change.
  • These options are experimental.
  • These options can only be tsconfig.json and not on the command line.

Relevant information