Course contentsShow
← TypeScript
Lesson 1193 of 1,79628. tsconfig in DepthFree lesson

strict vs Individual Flags

Deciding whether to use the strict umbrella flag or enable specific checks selectively.

strict vs Individual Flags in TypeScript

What you'll learn: How to decide whether to enable TypeScript's strict umbrella flag or toggle individual type-checking options selectively.

The Umbrella vs À La Carte Decision

You've seen that strict: true enables multiple safety features at once. But TypeScript also lets you enable those same checks individually. The question is: should you flip the master switch or pick and choose?

Think of it like a security system: strict locks all doors and windows simultaneously, while individual flags let you secure the front door but leave a side window cracked open.

What strict Actually Toggles

The strict flag is shorthand for:

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

Enabling strict: true sets all of these to true unless you explicitly override one.

When to Use the Umbrella

Start with strict: true for new projects. It's the recommended default and ensures maximum type safety. You get the full TypeScript experience without having to research each flag.

Greenfield codebases benefit most because you're not fighting legacy patterns—just write safe code from day one.

When to Use Individual Flags

For gradual migration, turn on flags one at a time:

  • Enable noImplicitAny first to surface obvious gaps
  • Add strictNullChecks once implicit types are fixed
  • Layer in others as you refactor

For teams with strong opinions, individual flags let you negotiate. Maybe your team accepts strictNullChecks but pushes back on noImplicitThis due to framework patterns.

For library compatibility, some older packages may struggle with certain strict checks. You might enable seven flags but leave one off temporarily.

The Hybrid Approach

You can enable strict: true and then disable specific checks:

{
  "compilerOptions": {
    "strict": true,
    "strictPropertyInitialization": false
  }
}

This keeps strictness by default but carves out an exception.

The Recommendation

Default to strict: true unless you have a compelling reason not to. Individual flags are escape hatches, not the preferred path. The TypeScript team designs features expecting strict mode—relaxing checks often means fighting the ecosystem.

Key Takeaway: Use strict: true for new projects and maximum safety; use individual flags only when migrating legacy code or negotiating team adoption incrementally.