strict
The whole family at once
Not an option so much as a subscription: it turns on eight other checks, and keeps turning on the ones added after you wrote your tsconfig.
- Since
- TypeScript 2.3
- In your tsconfig
"strict": true
The same snippet both times. Only the option changed.
With it off
"strict": falseexport function len(s: string | null) { return s.length }
Compiles clean
With it on
"strict": trueexport function len(s: string | null) { return s.length }
Emits TS18047
Why the compiler bothers
Every flag under this one exists because some category of runtime failure has a compile-time shadow. Turning them on individually is how a codebase ends up with seven of the eight, missing the one that mattered. The subscription behaviour is the feature, not a hazard: a release that adds a new check adds it to your build, which is the only way a strictness setting can keep meaning the same thing as the language changes underneath it.
Takeaway
Turn it on first and switch off what you cannot afford yet, rather than the reverse.
Where to go next
22 options

