Loading…

What is the purpose of tsconfig.json in Angularjs?

The tsconfig.json file allows us to specify the root level files and the compiler options required to compile a TypeScript project. This file in a directory determines that the said directory is the TypeScript project root.

Here is a sample JSON file describing how we can define a tsconfig.json file containing different parameters of the compilerOptions property:

{
    "compilerOptions": {
    "module": "system",
    "noImplicitAny": true,
    "removeComments": true,
    "allowUnreachableCode": false,
    "strictNullChecks": true,
    "outFile": "../JS/TypeScript/BestInterviewQuestion.js",
    "sourceMap": true
   }
}

Here is an example of these options.
  • target: It is used for the compiled output.
  • module: It is used in the compiled output. the system is for SystemJS, common for CommonJS.
  • moduleResolution: It is used to resolve module declaration files (.d.ts files). With the node approach, they are loaded from the node_modules.
  • sourceMap: generate or not source map files to debug your application.
  • emitDecoratorMetadata: emitDecoratorMetadata emit or not design-type metadata for decorated declarations in the source.
  • experimentalDecorators: It enables or not experimental support for ES7 decorators,
  • removeComments: remove comments or not
  • noImplicitAny: It is used to allow or not the use of variables.

Suggest An Answer

No suggestions avaliable!

Latest post from Angular 2 Interview Questions

Ask Question