tsconfig.json
suggest changetsconfig.json uses JSON with comments. Start with strict and relax individual checks only for a documented reason. A modern Node.js ESM library configuration can look like this:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": "src",
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"verbatimModuleSyntax": true,
"declaration": true,
"outDir": "dist"
},
"include": ["src/**/*.ts"]
}
This setup also requires the package to opt into ESM, commonly with "type": "module" in package.json. Applications may set noEmit when another tool emits JavaScript. Browser projects that use a bundler often pair module: "ESNext" with moduleResolution: "Bundler". Choose settings for the actual runtime instead of copying a supposedly universal configuration. strict does not enable noUncheckedIndexedAccess or exactOptionalPropertyTypes; they are separate, intentionally stricter checks.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents