1 min read

date: 04-Jan-2024
status: #status/processed
type: #type/doc
area: #area/tech#area/cheatsheet
keyword: #keyword/typescript#keyword/tsconfig


TSConfig

A tsConfig.json guide by Matt Pocock, the goat of typescript.

tsConfig.json
{
  "compilerOptions": {
    /* Base Options: */
    "esModuleInterop": true,
    "skipLibCheck": true,
    "target": "es2022",
    "allowJs": true,
    "resolveJsonModule": true,
    "moduleDetection": "force",
    "isolatedModules": true,
 
    /* Strictness */
    "strict": true,
    "noUncheckedIndexedAccess": true,
 
    /* If transpiling with TypeScript: */
    "moduleResolution": "NodeNext",
    "module": "NodeNext",
    "outDir": "dist",
    "sourceMap": true,
 
    /* AND if you're building for a library: */
    "declaration": true,
 
    /* if building for a lib in a monorepo: */
    "composite": true,
    "declarationMap": true,
 
    /* If NOT transpiling with TypeScript: */
    "moduleResolution": "Bundler",
    "module": "ESNext",
    "noEmit": true,
 
    /* If your code runs in the DOM: */
    "lib": ["es2022", "dom", "dom.iterable"],
 
    /* If your code doesn't run in the DOM: */
    "lib": ["es2022"]
  }
}