📋JSON Templates

tsconfig.json (TypeScript)

TypeScript compiler configuration with recommended settings.

Explanation

tsconfig.json controls TypeScript compiler behavior and project structure.

Examples

Strict Configuration
Output
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "commonjs",
    "lib": [
      "ES2022"
    ],
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules",
    "dist"
  ]
}

Code Examples

tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "commonjs",
    "lib": ["ES2022"],
    "outDir": "./dist",
    "rootDir": "./src",
    
    // Strict type checking
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    
    // Module resolution
    "moduleResolution": "node",
    "esModuleInterop": true,
    "resolveJsonModule": true,
    
    // Emit
    "declaration": true,
    "sourceMap": true,
    "removeComments": false,
    
    // Other
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist", "**/*.spec.ts"]
}

Try it Now

💡 Tips

  • Start with "strict": true for new projects
  • Use "skipLibCheck" to speed up builds
  • Set "module" based on target (ESM vs CommonJS)
  • Enable "sourceMap" for debugging
  • Use "paths" for module aliases

⚠️ Common Pitfalls

  • Inconsistent module settings can break builds
  • lib field must match target environment
  • Don't commit .tsbuildinfo files