tsconfig.json

Configuring tsconfig.json for a Node Project

Node ignores this file, but your editor and CI do not. Its job is narrow: describe the code accurately enough that tsc flags everything the runtime would choke on, and nothing else.

tsconfig.json for a Node 24+ serviceJSON
{
  "compilerOptions": {
    "target": "esnext", "lib": ["esnext"],
    "module": "nodenext", "moduleResolution": "nodenext",
    "types": ["node"],
    "strict": true, "noUncheckedIndexedAccess": true,
    "erasableSyntaxOnly": true, "verbatimModuleSyntax": true,
    "allowImportingTsExtensions": true, "rewriteRelativeImportExtensions": true,
    "noEmit": true, "skipLibCheck": true
  },
  "include": ["src/**/*.ts"]
}

target: "esnext" is right because Node is the only consumer, and downleveling would produce code Node cannot run anyway since stripping never transforms. Setting module and moduleResolution to nodenext makes the compiler apply Node's own rules — the "type" field and the exports maps from Modules in Practice — not a bundler's.

erasableSyntaxOnly and verbatimModuleSyntax are the pair from the previous subsection: mandatory on any project that runs .ts directly. The extension pair is what makes import './greet.ts' legal. allowImportingTsExtensions permits the spelling and rewriteRelativeImportExtensions turns it into ./greet.js when you emit, so one set of source files runs unbuilt in development and compiles cleanly for production. noEmit: true says this config checks rather than builds, and skipLibCheck: true skips checking inside .d.ts files, hiding errors that are almost always in somebody else's declarations.

npm 2,036 i -D typescript now installs TypeScript 7.0.2, the compiler rewritten in Go and released 8 July 2026; it reports 8x to 12x faster full builds than 6.0 and 6-26% less memory. The command line is unchanged, but several long-deprecated options are gone — target: "es5", the amd, umd and system module formats, baseUrl — so a config copied from an old project may fail to load. TypeScript 7 is also stricter about layout: once outDir is set and your sources sit in a subdirectory, error TS5011 insists you name rootDir explicitly. And 7.0 ships no programmatic API (7.1 is to restore it), so tools that call into the compiler, typescript-eslint 16,401 among them, install the JavaScript implementation alongside it as @typescript/typescript6.