What is the tsconfig.json file in TypeScript

A tsconfig.json file is a configuration file for TypeScript projects. It specifies the root files and the compiler options required to compile the project.

The tsconfig.json file is typically placed in the root directory of a TypeScript project. It can also be placed in a subfolder of the project. It contains a set of properties that specify the compiler options and other settings for the project.


  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
 "include": ["src/**/*"],
 "exclude": ["node_modules", "dist"]

Here’s a brief explanation of the properties used in this example:

  • compilerOptions: The object containing the settings for the TypeScript compiler.
    • target: The ECMAScript target version. For example, “es5”, “es6”, or “es2017”.
    • module: The module system to use. For example, “commonjs”, “amd”, “system”, “umd”, “es2015”, “es2020”, or “none”.
    • strict: Enables all strict type-checking options.
    • esModuleInterop: Enables emitting additional JavaScript to ease support for importing CommonJS modules. This is useful when working with modules that only have a default export.
    • skipLibCheck: Skips type checking of declaration files (.d.ts files).
    • forceConsistentCasingInFileNames: Enforces consistent casing for file names. This can help prevent issues on case-sensitive file systems and with source control.
  • include: An array of file paths or glob patterns to include in the compilation. This example, it includes all TypeScript files in the src directory and its subdirectories.
  • exclude: An array of file paths or glob patterns to exclude from the compilation. In this example, it excludes the node_modules, and dist directories.

That’s it.

Leave a Comment