What is the purpose of tsconfig.json?

I read angular2 referrences and found this tsconfig.json . I would like to know what the following options mean:

 { "compilerOptions": { "target": "es5", "module": "system", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "exclude": [ "node_modules" ] } 
+6
source share
3 answers

The tsconfig.json file matches the TypeScript compiler (tsc) configuration.

These links can give you information about these attributes:

Here are some suggestions:

  • target : language used for compiled output
  • module : module manager used in compiled form. system for SystemJS, commonjs for CommonJS.
  • moduleResolution : a strategy used to resolve module declaration files ( .d.ts files). Using the node approach, they are loaded from the node_modules folder as a module ( require('module-name') )
  • sourceMap : generate or not create source map files for debugging directly your TypeScript application files in a browser,
  • emitDecoratorMetadata strong>: emit or not create design type metadata for decorated ads in the source,
  • experimentalDecorators : allows or not experimental support for ES7 decorators,
  • removeComments : remove comments or not
  • noImplicitAny : allow or not use variables / parameters without types (implicit)
+12
source

tsconfig.json means that the directory in which it is stored is the root of the TypeScript project. The tsconfig.json file indicates the root files and compiler options needed to compile the project.

It is expected that the compiler will execute according to the specified configurations:

"target": "es5" => will compile es6 on es5 so that it is a compatible browser.

"module": "system" => defines the generation of the module code (commonjs', 'amd', 'system', 'umd', 'es6', etc.)

"moduleResolution": "node" => Determine how the modules will be solved.

"sourceMap": true => Creates the corresponding .map file so that it can be used in production code for debugging.

"removeComments": false => Delete all comments except the comments of the copy-right header starting with / *!

"noImplicitAny": false => Raise an error in expressions and declarations with an implied "any type".

If the "exclude" property is specified, the compiler includes all TypeScript files (* .ts or * .tsx) in the containing directory and subdirectories, with the exception of those files or folders that are excluded.

+3
source

The tsconfig file indicates the project as a typescript project, and it includes options for compiling typescript files. For more information, visit https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

+1
source

All Articles