tsconfig and Compiler Options
Navigate tsconfig.json — target, module, paths, include/exclude, and the compiler flags that shape how TypeScript reads your project.
tsconfig.json is the contract between your codebase and tsc. It defines which files participate, how imports resolve, what JavaScript version emits, and how strict the checker runs. Misaligned configs cause "works in IDE, fails in CI" or duplicate emit folders fighting your bundler.
Application projects often set noEmit: true — the bundler transpiles while tsc typechecks. Libraries emit .js and .d.ts to dist/ for consumers. Monorepos extend tsconfig.base.json and optionally use project references for build order.
Core compilerOptions
target sets emitted syntax level. module and moduleResolution must agree with your runtime — NodeNext for modern ESM packages. rootDir and outDir mirror folder structure in output. skipLibCheck speeds CI by skipping .d.ts validation in node_modules.
Application vs library configs
Apps add noEmit: true and let Vite or Next compile TypeScript. Libraries need declaration: true so consumers get .d.ts types. composite: true enables project references for packages/shared built before apps.
paths and baseUrl
paths maps import aliases like @/components to filesystem locations. baseUrl sets the resolution root. Bundlers need matching alias config — tsc paths alone do not rewrite emit without additional tooling.
| Option | Typical use |
|---|---|
| strict | Enable full strict bundle |
| noEmit | Typecheck-only apps |
| declaration | Library .d.ts emit |
| skipLibCheck | Faster CI |
include, exclude, and files
include globs select participating sources. exclude removes test fixtures and build output. files lists explicit paths — rare except tiny projects. Misconfigured include lets stray .ts files fail CI unexpectedly.
- extends for monorepo shared rules
- noEmit for app typecheck-only
- declaration for libraries
- 1tsconfig controls include and strictness
- 2Apps: noEmit; libs: declaration
- 3paths need bundler alignment
- 4Next: strict mode and tooling