tsconfig strict Explained: What It Does and When to Set It
strict switches on a family of TypeScript checks at once. See which flags it enables, the errors each one adds, the TypeScript 6.0 default and how to migrate.

The strict option in tsconfig.json is a single switch that turns on a whole family of type-checking flags. The reason it matters now is a change in TypeScript 6.0: strict defaults to true, so a project with no setting at all gets the strictest family of checks, and a project that relied on the old default of false has to say so explicitly. This post explains what strict enables, shows the errors you get with it and the code that sneaks through without it, covers how it interacts with individual flags, and gives a path for moving an existing codebase over. It uses TypeScript 6.x. The primary sources are the [strict entry in the tsconfig reference](https://www.typescriptlang.org/tsconfig/#strict) and the TypeScript 6.0 release notes.
What strict does
strict is an umbrella. Setting it to true enables every flag in the strict family, and each of those flags defaults to true when strict is on and false when it is off. The reference lists the family:
| Flag | What it checks |
|---|---|
noImplicitAny | A variable or parameter whose type cannot be inferred is an error, not any |
strictNullChecks | null and undefined are their own types, not members of every type |
strictFunctionTypes | Function parameters are compared contravariantly for function type properties |
strictBindCallApply | bind, call and apply are checked against the function's real signature |
strictPropertyInitialization | A class property must be assigned in the constructor or declared as possibly undefined |
strictBuiltinIteratorReturn | Built-in iterators return undefined instead of any for their final value |
noImplicitThis | An implicit this of type any is an error |
useUnknownInCatchVariables | A catch clause variable is unknown, not any |
alwaysStrict | Files are parsed in strict mode, and "use strict" is emitted |
The reference also warns that future TypeScript versions may add stricter checks under this flag, so an upgrade can surface new type errors in code that compiled before. That is a feature of the option, and also the main operational cost, which we come back to below.
The default in TypeScript 6.0
The 6.0 release notes state that strict is now true by default, reasoning that most new projects want it. If you already had "strict": true, nothing changes. If you depended on the old default, add "strict": false to keep the previous behavior. A minimal explicit file looks like this.
{
"compilerOptions": {
"strict": true
}
}Writing the line is harmless on 6.0, and it protects readers who see the file on older TypeScript versions, where the default was false. Teams that share configs across repositories pinned to different versions should write it down.
One more 6.0 change helps when you try these samples. If a tsconfig.json is present and you pass file names on the command line, tsc now reports TS5112, and the release notes point to --ignoreConfig to skip the config. Compile the whole project with tsc --noEmit and no file arguments.
Errors you get with strict on
Each flag adds a class of errors. The samples below are separate files, each compiled in a project where strict is true.
function double(n) {
return n * 2;
}implicit.ts(1,17): error TS7006: Parameter 'n' implicitly has an 'any' type.That is noImplicitAny. Without it, n would be any and the function would accept anything. Next, strictNullChecks.
const names = ["Ada", "Grace"];
const found = names.find((n) => n.startsWith("X"));
console.log(found.length);nullable.ts(5,13): error TS18048: 'found' is possibly 'undefined'.find returns undefined when nothing matches, and the type says so. With strict off, found would be string and the line would compile. At runtime the program would then fail with the message Cannot read properties of undefined (reading 'length'). That single class of bug is the main reason to turn the flag on.
strictPropertyInitialization catches a field that no code path assigns.
class User {
name: string;
}property.ts(2,3): error TS2564: Property 'name' has no initializer and is not definitely assigned in the constructor.And useUnknownInCatchVariables makes you check what was thrown, since JavaScript lets code throw anything.
try {
JSON.parse("{");
} catch (e) {
console.log(e.message);
}caught.ts(4,15): error TS18046: 'e' is of type 'unknown'.The fix is to narrow first, with e instanceof Error, and then read the message.
try {
JSON.parse("{");
} catch (e) {
console.log(e instanceof Error ? e.name : "unknown error");
}SyntaxErrorTurning individual flags off
strict sets defaults, and any single flag can override it. The reference shows this exact pattern: strict on with one family member switched off.
{
"compilerOptions": {
"strict": true,
"strictPropertyInitialization": false
}
}Order inside the file does not matter. An explicit value on a named flag always wins over what strict implies. This is the practical migration tool: leave strict on and opt out of the one or two flags that your codebase cannot satisfy yet.
What strict does not include
Some strictness options are separate and are not part of the family. noUncheckedIndexedAccess adds undefined to the result of indexing an array or a record, and exactOptionalPropertyTypes distinguishes a missing property from one set to undefined. Both catch real bugs and both are noisy on an existing codebase, so they are opt-in. noImplicitReturns and noFallthroughCasesInSwitch are also separate. If you want the strictest practical setup, write them next to strict.
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitReturns": true
}
}The difference shows up on a plain array access.
const words: string[] = ["alpha", "beta"];
const first = words[0];
console.log(first.toUpperCase());indexed.ts(5,13): error TS18048: 'first' is possibly 'undefined'.That error only appears with noUncheckedIndexedAccess on. Under plain strict, the line compiles and prints ALPHA.
Migrating an existing project
Turning strict on in a large codebase produces hundreds of errors, and trying to fix them in one pull request fails. A route that works is to take the flags one at a time. Start with "strict": false written out so the 6.0 default does not surprise you, then enable the cheap flags first: alwaysStrict, useUnknownInCatchVariables and strictBindCallApply usually produce few errors. Then noImplicitAny, which forces annotations, and strictFunctionTypes. Leave strictNullChecks and strictPropertyInitialization for last, because they touch the most code. When all of them pass, delete the individual lines and write "strict": true.
For a monorepo, put the settings in a shared base config and have packages extend it, then let packages opt out of one flag with an override while they catch up. A per-package override with a comment saying why is easier to track down than a global exemption.
Caveats
The first caveat is the upgrade effect. Because the reference says future versions may add checks to the family, a minor TypeScript upgrade can turn a green build red. Teams that want stability pin the compiler version and upgrade it on purpose, in its own pull request, with time to fix what shows up.
The second is that strict affects checking, and not what JavaScript is emitted, with one exception: alwaysStrict makes the compiler emit "use strict" and parse your code as strict mode. The 6.0 notes also deprecate setting alwaysStrict to false, since all code is assumed to be strict.
The third is that libraries and .d.ts files are checked too unless skipLibCheck is on. A dependency whose declarations do not hold up under strict can produce errors in files you do not own. Setting skipLibCheck hides them, at the cost of not catching genuine mistakes in declaration files.
The fourth is JavaScript. With allowJs and checkJs, strict checks apply to .js files as well, and untyped JavaScript produces a lot of implicit any errors. Turn on checkJs per file with a comment when migrating.
When to set it
For a new project, leave it on, and write "strict": true so the file says what it means on every TypeScript version. For an existing project on 6.0 or later that never set it, you were upgraded into true, so either fix the new errors or write "strict": false and migrate flag by flag. Set it to false for throwaway scripts, quick experiments and code you are only type-annotating for editor help. Do not set it to false merely because the errors are annoying: each of them is a runtime failure you would otherwise meet in production.


