Home

Configuring a TypeScript project using tsconfig.json

You can also provide compilation options that travel with your code via a tsconfig.json file. To start a new TypeScript project, cd into your project's root directory in a terminal window and run the following command.

tsc --init

This command will generate a tsconfig.json file with minimal configuration options, similar to below.

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "noImplicitAny": false,
    "sourceMap": false,
    "pretty": true
  },
  "exclude": ["node_modules"]
}

With a tsconfig.json file placed at the root of your TypeScript project, you can use the tsc command to run the compilation.



Last Updated on

Next Post: GraphProtocol: TS2322 null assignment in Subgraph →

Comments