Skip to main content

TypeScript analyzer

TypeScript Type Complexity

Flags recursive types, complex interfaces, deep generic nesting, conditional types, and large unions.

technical-debt ts-type-complexity

TypeScript Type Complexity

Flags recursive types, complex interfaces, deep generic nesting, conditional types, and large unions.

TypeScript's type system is Turing-complete and easy to over-engineer. Recursive types, deeply nested conditional types, and unions of 20+ members slow down the language server, blow up the inferred type display, and make error messages incomprehensible. This analysis surfaces type-level complexity hotspots so they can be simplified or extracted.

Severity guide

info
A complex type construct is present but at acceptable scale.
warning
A type construct will impact compile speed or error readability; consider simplifying.
critical
Not currently emitted by this analysis.

Remediation

Replace recursive types with iterative ones where possible; split large unions into discriminated cases; flatten deeply nested generics.

Replace recursive types with iterative ones where possible; split large unions into discriminated cases; flatten deeply nested generics.

Documentation