tsconfig-and-types.mdMarkdown, rendered
TSConfig and Type-System Guidance (2026)
Strictness baseline
Start with:
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitOverride": true,
"useUnknownInCatchVariables": true,
"verbatimModuleSyntax": true
}
}
Why these options matter
strict: enables the full strict-family baseline.noUncheckedIndexedAccess: addsundefinedfor undeclared indexed access, preventing false confidence in dictionary/index signature reads.exactOptionalPropertyTypes: distinguishes "property absent" from "property present but undefined".noImplicitOverride: catches inheritance drift by requiringoverride.useUnknownInCatchVariables: prevents assuming caught values areError.verbatimModuleSyntax: preserves import/export intent and avoids fragile emit rewrites.
Modern type-system habits
- Use
unknownat boundaries and narrow explicitly. - Use discriminated unions for state machines and API result variants.
- Use
satisfiesfor shape checking without widening literals. - Keep exported API return types explicit.
- Prefer utility types and mapped types over ad-hoc duplication.
Notes on generated defaults
Recent tsc --init templates favor stricter defaults and minimal config, including strictness and module-related options. Treat generated templates as starting points, not final architecture.
Sources
- TS 5.9 release notes (
tsc --initupdates): https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-9.html - TS config strict: https://www.typescriptlang.org/tsconfig/strict.html
- TS config noUncheckedIndexedAccess: https://www.typescriptlang.org/tsconfig/noUncheckedIndexedAccess.html
- TS config exactOptionalPropertyTypes: https://www.typescriptlang.org/tsconfig/exactOptionalPropertyTypes.html
- TS config noImplicitOverride: https://www.typescriptlang.org/tsconfig/noImplicitOverride.html
- TS config useUnknownInCatchVariables: https://www.typescriptlang.org/tsconfig/useUnknownInCatchVariables.html