TypeScript 6.0 broke my build: strict mode is now on by default
TypeScript 6.0 (the bridge release ahead of the Go-native 7.0 compiler) turned on `strict: true` and several other options by default for new tsconfig.json files, and tightened behavior generally as part of aligning with 7.0. A project that relied on looser implicit defaults can suddenly surface dozens of previously-hidden errors. Explicitly set the options you actually want in tsconfig.json rather than relying on the previous implicit defaults.
What causes this error
TypeScript 6.0 was released as a deliberate bridge toward the Go-based 7.0 compiler, tightening defaults (including `strict: true`, a modern `target`, and `types: []` instead of auto-including everything in `node_modules/@types`) to reduce the gap between what 6.0 and 7.0 accept. A project that never explicitly set these options in `tsconfig.json` inherits the new, stricter defaults on upgrade — and can go from a clean build to dozens of new errors at once.
The Fix
// tsconfig.json — pin the behavior explicitly instead of relying on
// whatever the compiler's current defaults happen to be
{
"compilerOptions": {
"strict": true, // or explicitly false if you're not ready yet
"target": "es2022",
"types": ["node"], // explicitly list global type packages you need
"skipLibCheck": true
}
}Migrate incrementally: upgrade to 6.0 first and resolve strict-mode errors file by file (many editors can show a per-file error count), rather than trying to fix everything in one pass.
Common causes / variations
- A `tsconfig.json` with no explicit `strict` setting, previously relying on an older, looser default
- Global `@types` packages (like `@types/node`) no longer being picked up automatically after `types: []` became a factor
- `target: es5` and other legacy options being deprecated ahead of removal in TypeScript 7.0
Related errors
See also: target=es5 no longer supported, baseUrl deprecated.
Comments
Loading comments...