Advertisement
Intermediate TypeScript, tsconfig & Compiler Options

What does the 'strict' compiler option actually enable, and which individual flags does it bundle together?

Short answer

'strict': true is a shorthand that enables a whole family of individual strictness flags at once, including noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, alwaysStrict, and useUnknownInCatchVariables —…

Save TypeScript mock interview
Advertisement
AModel answer
'strict': true is a shorthand that enables a whole family of individual strictness flags at once, including noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, alwaysStrict, and useUnknownInCatchVariables — collectively representing TypeScript's recommended, most type-safe configuration.
// Equivalent to manually setting all of these to true:
{
  "compilerOptions": {
    "strict": true
    // implies: noImplicitAny, strictNullChecks, strictFunctionTypes,
    // strictBindCallApply, strictPropertyInitialization, noImplicitThis,
    // alwaysStrict, useUnknownInCatchVariables
  }
}
Real-world example
Enabling the single 'strict' flag as the recommended baseline for any new TypeScript project, rather than manually toggling each sub-flag.
Likely follow-ups
  • Can you enable 'strict': true globally but explicitly opt OUT of just one specific sub-flag?
Related topics