strictNullChecks, noImplicitAny, strictFunctionTypes, and friends catch entire bug classes. Enable strict on new projects.
Flag highlights
noImplicitAny— untyped parameters become errorsstrictNullChecks— nullability respectednoUncheckedIndexedAccess— index access may be undefined
Self-check
- Name one bug
strictNullChecksprevents in UI code.
Turn on strict early; retrofiting a large codebase later is far more expensive than fixing violations lesson by lesson.
Tip: Enable strict on greenfield repos—retrofits are painful.
Interview prep
- What does strict enable?
A family of flags including
strictNullChecksandnoImplicitAnyfor safer defaults.