tsconfig.json
Note: These are the default settings we use, but other options/settings : https://www.typescriptlang.org/docs/handbook/tsconfig-json.html .
compilerOptions
"sourceMap": true
Generates .map files that map the compiled JavaScript back to the original TypeScript for debugging.
"sourceMap": truetrue→ Enables source maps for debugging.false→ No source maps (smaller build, harder debugging).
"noImplicitAny": false
Allows implicit any type inference.
"noImplicitAny": falsetrue→ Errors ifanyis inferred.false→ Allows implicitany.
"lib": ["esnext", "dom", "dom.iterable"]
Specifies standard libraries to include.
"lib": ["esnext", "dom", "dom.iterable"]"esnext"→ Includes latest JavaScript features."dom"→ Enables browser APIs."dom.iterable"→ Supports iteration over DOM collections.- Other options:
"ES6","ES2017","WebWorker", etc.
"declaration": true
Generates .d.ts files for type definitions.
"declaration": truetrue→ Generates declaration files.false→ Skips.d.tsfiles.
"declarationMap": true
Enables .d.ts.map files for better debugging.
"declarationMap": truetrue→ Creates.d.ts.mapfiles.false→ Skips.d.ts.map.
"removeComments": true
Removes comments from compiled JavaScript.
"removeComments": truetrue→ Removes comments.false→ Keeps comments.
"allowJs": true
Allows JavaScript (.js) files in TypeScript.
"allowJs": truetrue→ Allows JS files in the project.false→ TypeScript-only mode.
"baseUrl": "./src"
Sets the base directory for module resolution.
"baseUrl": "./src"- Enables absolute imports.
- Without this, imports must use relative paths.
"esModuleInterop": true
Improves compatibility between CommonJS and ES modules.
"esModuleInterop": truetrue→ Allows default imports from CommonJS.false→ Requiresimport * as.
"resolveJsonModule": true
Allows importing JSON files.
"resolveJsonModule": truetrue→ Allows JSON imports.false→ Disables JSON imports.
"module": "ESNext"
Specifies the module system.
"module": "ESNext""CommonJS"→ Usesrequire()."ESNext"→ Usesimport/export.- Other options:
"AMD","UMD","System".
"target": "ESNext"
Defines the ECMAScript version for compiled code.
"target": "ESNext""ES5"→ For old browsers (IE11)."ES6"→ Modern browsers."ESNext"→ Latest JavaScript features.
"moduleResolution": "bundler"
Defines module resolution strategy.
"moduleResolution": "bundler""node"→ Standard Node.js resolution."bundler"→ Optimized for modern bundlers.
"outDir": "./dist"
Sets the output folder for compiled JavaScript.
"outDir": "./dist""jsx": "preserve"
Controls JSX transformation.
"jsx": "preserve""preserve"→ Keeps JSX syntax (for Babel)."react"→ Converts JSX toReact.createElement."react-jsx"→ Uses the new React JSX runtime.
"skipLibCheck": true
Skips type checking for libraries.
"skipLibCheck": truetrue→ Faster builds, may skip type errors.false→ Strict type checking.
📂 include & exclude
** "include": ["./src"]**
Specifies which files to compile.
"include": ["./src"]"exclude": ["node_modules", "dist"]
Specifies which files to ignore.
"exclude": ["node_modules", "dist"]⚡ ts-node Settings
"ts-node": { "transpileOnly": true }
Speeds up ts-node execution by skipping type checking.
"ts-node": {
"transpileOnly": true
}