Real World Example

A Production tsconfig for a Node.js API

This is the kind of configuration used by backend teams at fintechs and SaaS companies: a shared strict base, a build config that excludes tests, and the extra safety flags.

Example

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2022",
    "lib": ["ES2023"],
    "module": "nodenext",
    "moduleResolution": "nodenext",
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitOverride": true,
    "noFallthroughCasesInSwitch": true,
    "exactOptionalPropertyTypes": true,
    "verbatimModuleSyntax": true,
    "isolatedModules": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "declaration": false,
    "rootDir": "src",
    "outDir": "dist"
  },
  "include": ["src"]
}

Example

tsconfig.build.json

{
  "extends": "./tsconfig.json",
  "exclude": ["src/**/*.test.ts", "src/**/__mocks__"]
}

Example

package.json scripts:

"scripts": {
  "dev": "tsx watch src/main.ts",
  "typecheck": "tsc --noEmit",
  "build": "tsc -p tsconfig.build.json",
  "start": "node --enable-source-maps dist/main.js"
}