Node app: target a modern Node version, keep ESM/CJS consistent, emit source maps, and enable strict checks. React app: target modern browsers, use JSX transform, and enable strict to catch UI bugs early.
Quick Node example: strict, module: node16 or nodenext, target: ES2021+, moduleResolution: node, esModuleInterop: true, outDir: dist, sourceMap: true, noEmitOnError: true.
Quick React example: strict, jsx: react-jsx, target: ES2020+, module: ESNext, moduleResolution: bundler or node, paths for aliases, skipLibCheck for CI speed if needed (but keep it on locally if possible).
Example code
// Node tsconfig.json
{
"compilerOptions": {
"strict": true,
"target": "ES2021",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"outDir": "dist",
"sourceMap": true,
"noEmitOnError": true
},
"include": ["src"]
}
// React tsconfig.json
{
"compilerOptions": {
"strict": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "Bundler",
"jsx": "react-jsx",
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
}
}