TypeScript type coverage above 85%
Why it matters
High any density in core business logic means TypeScript's safety guarantees are opt-out rather than opt-in across the most critical code paths. ISO 25010:2011 §6.5.5 treats this as a reliability defect: when an API response shape changes, a database column is renamed, or a third-party SDK updates its return type, any-saturated code compiles without complaint and fails silently or noisily at runtime. A practical threshold is fewer than 15% of typed positions using any — above that, the type checker is too porous to catch refactoring regressions.
Severity rationale
High because pervasive `any` usage renders TypeScript's compile-time safety effectively optional, meaning refactoring regressions and API shape changes surface only at runtime.
Remediation
Replace any with unknown for values with genuinely unknown types, then narrow at the usage site. Work through the highest-traffic files first — src/lib/, src/services/, and API handlers typically have the most impact.
// Bad: loses all type information
function processResponse(data: any) {
return data.result.items;
}
// Good: preserves type safety with runtime validation
function processResponse(data: unknown): Item[] {
if (!isApiResponse(data)) throw new Error('Unexpected API response shape');
return data.result.items;
}
To measure your starting point: npx type-coverage --detail reports the percentage of fully-typed nodes across the project.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Code Quality Essentials Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · maintainability.testability — Maintainability — Testability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from code-quality-essentials·automated