← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

TypeScript Strict Mode

TypeScript 2.3 Intermediate
debt(d5/e7/b7/t7)
d5 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'specialist tool catches it' (d5). The detection_hints list TypeScript compiler and ESLint as tools, and the code_pattern explicitly identifies tsconfig.json without strict:true. The TypeScript compiler itself will flag errors once strict is enabled, but the absence of strict mode is not caught by a default linter rule — you need to deliberately inspect tsconfig or run a TypeScript-aware config linter to detect the omission, placing it at the specialist tool level.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7). The quick_fix says add 'strict': true to tsconfig.json, which is a one-liner, but the common_mistakes explicitly warn that adding it later requires fixing hundreds of type errors across the codebase. This is inherently cross-cutting — every file with implicit any, null/undefined assumptions, or non-null assertions must be visited and corrected, making the remediation effort span the entire project.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b7). The applies_to covers web and cli contexts broadly, and the choice shapes every future type annotation decision across the entire codebase. Without strict mode, every maintainer is working with a weakened type system, and the misconception field notes it creates a false sense of type safety. Third-party library usage is also affected under strict mode per common_mistakes, meaning the burden extends to integration points as well. Every new file, every new developer, and every dependency is shaped by this foundational configuration choice.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap — contradicts how a similar concept works elsewhere' (t7). The misconception field explicitly states developers believe strict mode is too restrictive for real projects, when in fact it is the recommended default. This directly contradicts the intuition that type-checking strictness should be relaxed for pragmatic production use. Additional traps include the non-null assertion operator (!) appearing to satisfy the type checker while being a runtime lie, and the surprise that enabling strict mode retroactively breaks previously-compiling code — all documented in common_mistakes as serious gotchas.

About DEBT scoring →

Also Known As

strict mode strictNullChecks noImplicitAny tsconfig strict

TL;DR

A tsconfig flag that enables the strictest type-checking options — strictNullChecks, noImplicitAny, and others — catching the most common TypeScript pitfalls.

Explanation

strict: true in tsconfig.json enables: strictNullChecks (null/undefined are not assignable to other types), noImplicitAny (implicit any is an error), strictFunctionTypes (stricter function parameter checking), strictPropertyInitialization (class properties must be initialised), and more. Most TypeScript bugs caught in the wild are prevented by strictNullChecks alone. Starting with strict: true from day one is far cheaper than enabling it on an existing codebase.

Common Misconception

Strict mode is too restrictive for real projects — strict mode is the recommended default for all new TypeScript projects; disabling it to avoid fixing errors creates a false sense of type safety.

Why It Matters

Without strictNullChecks, TypeScript misses the most common class of runtime errors — null/undefined access — making it barely better than plain JavaScript for null safety.

Common Mistakes

  • Not enabling strict mode on new projects — adding it later requires fixing hundreds of type errors.
  • Disabling specific strict checks to silence errors instead of fixing the underlying type issue.
  • Using non-null assertion (!) to bypass strictNullChecks — this is a runtime lie; validate instead.
  • Not realising strict mode affects third-party library usage — some older libraries have poor types under strict mode.

Code Examples

✗ Vulnerable
// Without strictNullChecks — null errors invisible:
function getUsername(user: User): string {
    return user.name.toUpperCase(); // No error even if name is null
}
// Runtime: TypeError: Cannot read properties of null (reading 'toUpperCase')
✓ Fixed
// tsconfig.json:
{ "compilerOptions": { "strict": true } }

// With strictNullChecks — null must be handled:
function getUsername(user: User): string {
    if (!user.name) return 'Anonymous';
    return user.name.toUpperCase(); // TypeScript knows name is string here
}
// Or with optional chaining:
function getUsername(user: User): string {
    return user.name?.toUpperCase() ?? 'Anonymous';
}

Added 15 Mar 2026
Edited 22 Mar 2026
Views 52
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 1 ping W 2 pings T 0 pings F 2 pings S 2 pings S 3 pings M 1 ping T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Perplexity 8 Scrapy 8 Amazonbot 7 SEMrush 5 Ahrefs 4 Google 4 Unknown AI 3 Claude 1 Meta AI 1
crawler 38 crawler_json 2 pre-tracking 1
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Medium
⚡ Quick Fix
Add "strict": true to tsconfig.json — it enables noImplicitAny, strictNullChecks, and 6 other checks; fix errors incrementally using // @ts-expect-error comments as temporary markers
📦 Applies To
typescript 2.3 web cli
🔗 Prerequisites
🔍 Detection Hints
tsconfig.json without strict:true; noImplicitAny:false; strictNullChecks:false allowing null/undefined anywhere
Auto-detectable: ✓ Yes typescript eslint
⚠ Related Problems
🤖 AI Agent
Confidence: High False Positives: Low ✓ Auto-fixable Fix: Low Context: File


✓ schema.org compliant