Recommended config

2 snippets in TypeScript

TSTypeScript

strict Mode

TS · Configuration
Syntax
// tsconfig.json
{ "compilerOptions": { "strict": true } }
Example
// strict: true enables ALL of these at once:
// - strictNullChecks: null/undefined not assignable to other types
// - strictFunctionTypes: contravariant function parameter checking
// - strictBindCallApply: type-check bind, call, apply
// - strictPropertyInitialization: class props must be initialized
// - noImplicitAny: error on implicit any
// - noImplicitThis: error on 'this' with implicit any type
// - useUnknownInCatchVariables: catch variable is unknown, not any
// - alwaysStrict: emit "use strict" in every file
Output
// strict: true is the recommended baseline for all new projects

Note Always start new projects with strict: true. You can selectively disable individual checks if needed (e.g., "strictPropertyInitialization": false) while keeping the rest. Enabling strict on a large existing JS-to-TS migration can produce thousands of errors - enable checks incrementally in that case.

Essential Compiler Options

TS · Configuration
Syntax
// tsconfig.json compilerOptions
Example
{
  "compilerOptions": {
    "strict": true,
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "allowImportingTsExtensions": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "lib": ["ES2022", "DOM", "DOM.Iterable"]
  },
  "include": ["src"]
}
Output
// A solid starting tsconfig for a modern bundled web app

Note moduleResolution: "bundler" (TS 5.0+) matches how Vite/webpack/esbuild resolve modules - it supports exports maps, .ts extensions in imports, and does not require file extensions. skipLibCheck: true speeds up compilation by not checking node_modules .d.ts files (only your code is checked).

Frequently asked questions

How does TypeScript handle recommended config?
TypeScript covers this with 2 copy-ready snippets on this page. The "strict Mode" snippet in TypeScript uses `// tsconfig.json`.
Which code does the TypeScript example use?
The "strict Mode" snippet uses `// tsconfig.json`, from the Configuration section of the TypeScript cheat sheet.
What other TypeScript snippets are shown for "recommended config"?
Besides "strict Mode", this page also shows "Essential Compiler Options".
Is there anything to watch out for?
Yes. For "strict Mode": Always start new projects with strict: true. You can selectively disable individual checks if needed (e.g., "strictPropertyInitialization": false) while keeping the rest. Enabling strict on a large existing JS-to-TS migration can produce thousands of errors - enable checks incrementally in that case.