Architecture
Advanced

TSConfig, Modules, and Monorepos

Configure TypeScript for Node, browser apps, packages, and multi-project workspaces.

48 min
3 sections
tsconfig
modules
monorepo
project-references
1
2
3

01. Separate App and Package Configs

Section 1 of 3

Apps and packages have different TypeScript responsibilities. Apps usually type-check and let a bundler emit. Packages often emit declarations and may compile source. Keep shared base config strict and override per target.

json
// tsconfig.base.json
{
  "compilerOptions": {
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "skipLibCheck": false
  }
}

// apps/web/tsconfig.json
{
  "extends": "../../tsconfig.base.json",
  "compilerOptions": {
    "noEmit": true,
    "jsx": "preserve"
  }
}

Exercise

Design workspace configs

Practice

Create a base config, a web app config, and a shared package config for a monorepo.

Back to Course