tsconfig.json in TS Project

The tsconfig.json file corresponds to the configuration of the TypeScript compiler (tsc).

tsconfig.json signifies the directory in which it is kept is the root of TypeScript project. The tsconfig.json file specifies the root files and the compiler options required to compile the project.

Note: tsconfg.json is supported since the release of TypeScript 1.6.

Read about TypeScript Environment Setup

Example tsconfig.json

  "extends": "@tsconfig/node13/tsconfig.json",
  "compilerOptions": {
    "preserveConstEnums": true
  "include": ["src/**/*"],
  "exclude": ["node_modules", "**/*.spec.ts"]

Generate tsconfig.json

Make sure you have installed typescript. Read more about TypeScript Environment Setup

Install typescript

We can install typescript using npm

npm install -g typescript

Verify tsc Installation

We can verify by getting tsc version.

tsc -v


Version 4.7.4

Note: Make sure the tsc version is > 1.6

init tsconfig using tsc

tsc --init


Created a new tsconfig.json with:  TS 
  target: es2016
  module: commonjs
  strict: true
  esModuleInterop: true
  skipLibCheck: true
  forceConsistentCasingInFileNames: true

You can see tsc file generated in your project.


typescript programming

Subscribe For More Content