AI Hints
Home›TypeScript Tutorial›Configuration and Packages
TypeScript · Lesson 76 of 120

tsconfig.json

The settings.

⏱ 2 min read▶ Video at 59:05🎓 Free
Watch this lesson in the TypeScript courseWatch on YouTube ↗Full TypeScript course

Every TypeScript project has a tsconfig dot JSON file. It tells the compiler which files to check, how strict to be, and what kind of JavaScript to write.

tsconfig.json
From the video: tsconfig.json
  • One settings file
  • Which files
  • How strict

tsconfig.json

Strict turns on all the safety checks. Target picks the JavaScript version to write. Module and module resolution follow Node's rules. Out dir is where the JavaScript goes. And include lists the source files.

tsconfig.jsonjson
{
  "compilerOptions": {
    "strict": true,
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "outDir": "dist",
    "skipLibCheck": true
  },
  "include": ["src"]
}

Getting one

NPXTSC dash dash init creates a tsconfig with comments explaining every option. Frameworks usually give you one already. Start strict, and keep it strict.

keyvalue
Createnpx tsc --init
Frameworksprovide one
strictalways on
Runnpx tsc

Summary

Tsconfig dot JSON controls what's checked, and how. Next, strict mode.

Key takeaways
  • strict
  • target
  • outDir
Next up: Strict Mode — the safety switches