Skip to main content

TypeScript analyzer

TypeScript Structural Quality

Detects singleton patterns, empty catches, untyped throws, concrete-class imports, global state, and good patterns (factories, constructor injection).

patterns ts-structural-quality

TypeScript Structural Quality

Detects singleton patterns, empty catches, untyped throws, concrete-class imports, global state, and good patterns (factories, constructor injection).

Beyond TypeScript-specific shape concerns, codebases accumulate structural anti-patterns: silent catch blocks that swallow errors, singletons that hide coupling, direct imports of concrete classes that block substitution, and global-state access that makes testing harder. This analysis flags the most common problems and also surfaces healthy patterns (factory functions, constructor injection, using declarations) when they appear.

Severity guide

info
A positive pattern was detected and is contributing to better structure.
warning
A structural anti-pattern is present and should be reviewed.
critical
An anti-pattern is silently masking errors or hiding bugs — fix immediately.

Remediation

Replace empty catches with explicit handling; throw typed errors; inject dependencies instead of importing concrete classes; avoid globalThis/window access in business logic.

Replace empty catches with explicit handling; throw typed errors; inject dependencies instead of importing concrete classes; avoid globalThis/window access in business logic.

Documentation