C.W.K.
Stream
Lesson 01 of 05 · published

`strict: true` and the Family Flags

~8 min · strict-mode, strict, tsconfig

Level 0Curious
0 XP0/93 lessons0/23 achievements
0/100 XP to next level100 XP to go0% complete
"strict: true is a meta-flag. Seven checks turn on as one."

The family

"strict": true in tsconfig.json turns on seven separate strictness flags simultaneously:

  • noImplicitAny
  • strictNullChecks
  • strictFunctionTypes
  • strictBindCallApply
  • strictPropertyInitialization
  • noImplicitThis
  • useUnknownInCatchVariables

Each is meaningful on its own; turning them all on together is the default for new TypeScript projects in 2026.

Why all together

The seven flags catch different kinds of latent type weakness. Turning on one but not the others leaves gaps. The recommended posture is strict: true from day one — every flag, no exceptions.

For projects that can't go full strict (legacy code, gradual migration), you can opt out of individual flags one at a time. The general direction should always be toward more strict, not less.

strict isn't the end

Three additional flags catch things even strict: true misses:

  • noUncheckedIndexedAccess — types index access as T | undefined
  • exactOptionalPropertyTypes — distinguishes missing from explicit undefined
  • noImplicitReturns — functions must return something on every code path

For new projects, turn these on too. The @tsconfig/strictest base includes all of them.

The maximum-strict tsconfig is the right starting point. Every flag earns its keep; every bug it catches saves a debugging session later. Start strict, stay strict.

Code

Maximum-strict tsconfig·json
// tsconfig.json — full strict + extra flags.
{
  "compilerOptions": {
    "strict": true,
    // The seven sub-flags above are implicit when strict: true is on.
    // Extra-strict flags not in strict:true:
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    // Common companions:
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "verbatimModuleSyntax": true
  }
}

// Or just inherit the community 'strictest' base:
{
  "extends": "@tsconfig/strictest/tsconfig.json"
}

External links

Exercise

In a new project, enable strict: true plus the three extra flags from this lesson. Write a few intentionally-loose lines (unannotated params, possibly-null access, possibly-out-of-bounds index access) and observe each flag firing. Pick one to leave on and one to disable — note how the code feels different.
Hint
The extra flags don't kick in for strict: true alone. Each catches a different category of latent unsafety. Once you've seen them fire on real code, you'll want them on permanently.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.