Last active
November 2, 2025 21:22
-
-
Save mschwarzmueller/2ba4a82da34298d7a545269256ed6acf to your computer and use it in GitHub Desktop.
A good default tsconfig.json file - for frontend projects & Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "target": "ES2022", // Good for modern browsers or Node.js | |
| "compilerOptions": { | |
| "esModuleInterop": true, // Ensures ESM and CJS imports work together well | |
| "skipLibCheck": true, // Ensures .d.ts files from 3rd libraries are not type-checked | |
| "target": "es2022", // Sets a relatively modern ECMAScript version as compilation target | |
| "allowJs": true, // Allows importing .js files into .ts (helpful when migrating projects) | |
| "strict": true, // Ensures strict type checking (i.e., noImplicitAny etc) | |
| "noUncheckedIndexedAccess": true, // Adds undefined as a value when accessing by index | |
| // "noImplicitOverride": true, // Enable this when working with classes & inheritance | |
| "noUnusedLocals": true, // to avoid unused variables | |
| "module": "NodeNext", // Supports both ESM & CJS modules / imports; Consider using ESNext for frontend projects | |
| "outDir": "dist", // Store compiled files in "dist" folder | |
| "sourceMap": true, // Enables source maps for easier debugging | |
| "lib": ["ES2022", "DOM", "DOM.Iterable"] // Or without "dom" libs when building for Node | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a very basic
tsconfig.jsonfile - it will not work well (or at all) when using a bundler or build tool like Vite.That's on purpose as you'll typically create a project based on a template or with a tool like Vite when using a more complex build workflow. In those cases, a fitting
tsconfig.jsonfile will typically be generated for you.