TypeScript Intersection Types Can Silently Break Code When Properties Conflict

TypeScript intersection types follow set-theoretic rules, meaning A & B requires values that satisfy both types simultaneously — not a simple merge of their properties. When two intersected types share a property with incompatible types, TypeScript resolves that property to 'never', which can silently break type safety without raising an immediate compiler error. This subtle behavior causes production failures when developers assume intersection behaves like object spread, leading to types that accept no valid runtime value. Compatible types with non-overlapping or matching property signatures compose cleanly, while conflicting signatures collapse the intersection entirely. Understanding this distinction helps developers choose between intersection types for combining capabilities and union types for representing one-of-several-shapes scenarios.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in