Compiling with tsconfig
A tsconfig.json file tells tsc how to compile your project — which JavaScript version to target, how strict the type checking should be, where compiled files should go — instead of passing a long list of flags on the command line every time.
Creating one
tsc --init
This generates a tsconfig.json in the current directory with sensible defaults, mostly commented out, ready to uncomment and adjust as needed. From then on, running plain tsc with no arguments picks it up automatically and compiles the whole project according to it.
A typical minimal config
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"strict": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*.ts"]
}
target sets which JavaScript version the output should run on — older targets add more compatibility shims for newer syntax. outDir and rootDir keep compiled .js files separate from your source .ts files, so tsc reads from src/ and writes to dist/ without mixing the two.
The strict flag
function greet(name) {
return "Hello, " + name;
}
loose.ts:1:14 - error TS7006: Parameter 'name' implicitly has an 'any' type.
Without strict, that same function compiles fine, with name silently treated as any. "strict": true is actually shorthand that turns on a whole group of individually-named checks at once — including noImplicitAny, which is what's catching this — rather than a single setting on its own.
"strict": true on for an existing, previously-loose codebase can surface dozens or hundreds of errors instantly, since it's really several checks turning on simultaneously rather than one. Most teams either enable it from day one on a new project, or turn on the individual strict-family flags one at a time on an older codebase to make the migration reviewable in smaller pieces, rather than flipping the single umbrella flag and facing the entire backlog at once.tsconfig.json settings that tie a whole project together. From here, the natural next steps are picking a framework that leans on these types heavily (React with TypeScript, or a backend framework like NestJS), and revisiting the JavaScript course for anything that felt unfamiliar along the way.