Modules, Runtime & Tooling
tsconfig & Module Resolution
tsconfig.json controls how TypeScript checks and emits a project: target, module system, strictness, JSX, included files, path aliases, library types, and resolution rules.targetcontrols emitted JavaScript syntaxmodulecontrols emitted module formatmoduleResolutioncontrols how imports are foundlibcontrols available ambient types- Strictness is part of architecture
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true
},
"include": ["src"]
}| Option | Controls | Common mistake |
|---|---|---|
| target | Output syntax | Assuming it polyfills APIs |
| module | Output module format | Mismatch with runtime |
| moduleResolution | How imports resolve | Using old mode with modern exports |
| lib | Available ambient types | Typing APIs not present in runtime |
| strict | Type-checking baseline | Leaving it off indefinitely |
| paths | Compile-time aliases | Forgetting runtime/bundler support |