Testing & Code Quality
tsconfig Strictness
TypeScript strictness options determine how aggressively the compiler rejects unsafe patterns.
strict is the baseline; additional flags catch indexing, optional-property, override, and unchecked access bugs.strictis the serious-project baselinenoUncheckedIndexedAccessmakes indexing honestexactOptionalPropertyTypestightens optional semanticsnoImplicitOverrideprotects inheritance- Strictness migration should be planned
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitOverride": true,
"noFallthroughCasesInSwitch": true
}
}| Option | Catches |
|---|---|
| strict | Core strict checking family |
| noUncheckedIndexedAccess | Possibly missing indexed values |
| exactOptionalPropertyTypes | Ambiguous optional vs undefined |
| noImplicitOverride | Accidental non-overrides |
| noFallthroughCasesInSwitch | Unintentional switch fallthrough |
| noImplicitReturns | Missing return paths |