Skip to main content

TypeScript analyzer

TypeScript Utility Types Usage

Detects custom mapped types that duplicate built-in utility types, and reports utility-type leverage.

patterns ts-utility-types

TypeScript Utility Types Usage

Detects custom mapped types that duplicate built-in utility types, and reports utility-type leverage.

TypeScript ships with a rich set of utility types — Partial, Pick, Omit, Record, Readonly, Required, etc. — that compose to express common type transformations. Custom mapped types that replicate these built-ins (e.g., a hand-written type Optional<T> = { [K in keyof T]?: T[K] }) add maintenance cost without adding capability. This analysis surfaces duplicates and reports overall utility-type usage as a signal of type-system leverage.

Severity guide

info
Utility-type usage is healthy or absent without need for concern.
warning
A custom mapped type duplicates a built-in utility type; replace with the built-in.
critical
Not currently emitted by this analysis.

Remediation

Replace hand-written mapped types with built-in equivalents (Partial, Pick, Omit, Record, etc.).

Replace hand-written mapped types with built-in equivalents (Partial, Pick, Omit, Record, etc.).

Documentation