October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

TypeScript `interface extends` vs. Intersection: When the Difference Breaks Your Code

TypeScript interfaces reject incompatible inherited members at composition; intersections keep both requirements, so a conflict can make a property or the whole type impossible.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

interface extends and & both combine object types, but they handle conflicting properties differently. Extending incompatible interfaces is an error at the declaration; an intersection requires a value to satisfy both property types, which can make the property impossible—or reduce the whole type to never when conflicting properties are discriminants. An intersection does not overwrite a property.

How interface extension and intersection handle a conflict

Consider two contracts that give id incompatible types:

interface HasId {
  id: string;
}

interface NumericId {
  id: number;
}

The outcome depends on how you combine them:

Composition When the conflict appears Meaning of id Can a value satisfy it?
interface Combined extends HasId, NumericId The interface declaration is rejected because the inherited property declarations conflict. No valid combined interface member is formed. No; the composition itself is an error.
type Combined = HasId & NumericId The alias can be declared; the conflict matters when using the resulting type. A value must meet both the string and number requirements. For these incompatible primitive types, no ordinary value can satisfy the property.

The TypeScript Handbook describes conflict handling as the principal difference between these approaches. It says that incompatible same-name properties in an extension produce an error, while intersection properties with different types are merged. Here, “merged” means both constraints apply—not that one type replaces the other. See the TypeScript Handbook: Object Types.

Why an intersection does not mean “the second type wins”

An intersection describes values that belong to both constituent types. It is not object spread, assignment order, or an override operation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
interface HasId {
  id: string;
}

interface NumericId {
  id: number;
}

type Both = HasId & NumericId;

declare const value: Both;
value.id; // must satisfy both string and number

Writing HasId & NumericId does not make id a number merely because NumericId appears second. Nor does it make it a string. A value of type Both must satisfy both declarations, so a conflicting primitive property leaves no usable value to construct.

If you actually intend to replace a property, express that transformation rather than relying on an intersection. For example, omit the old key and then declare its replacement:

Rank #2
TypeScript Programming Language - Software Engineer & Coder T-Shirt
  • TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
  • TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem
type WithNumericId = Omit<HasId, "id"> & {
  id: number;
};

This says explicitly that the original id requirement is removed before the replacement is added.

When conflicting discriminants make an intersection never

Some conflicts affect more than one property. A discriminant is commonly a literal-valued property, such as kind, used to tell variants apart. Intersecting two variants that require different values for the same discriminant can collapse the entire type:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
interface Circle {
  kind: "circle";
  radius: number;
}

interface Square {
  kind: "square";
  sideLength: number;
}

type Impossible = Circle & Square;

A value cannot have kind equal to both "circle" and "square". TypeScript 3.9 release notes document that intersections with conflicting discriminant properties can be reduced to never. Once the type is never, property access fails because there is no possible value to access. This release note establishes the behavior for that documented case; it is not a complete version-by-version account of every intersection rule. See the TypeScript 3.9 release notes.

Why extends can error while an intersection can be declared

The two forms make different requests of the compiler. An interface extending other interfaces asks for one coherent interface contract. If inherited members with the same name cannot be reconciled, TypeScript reports the problem at that composition point. That makes the conflict visible when the interface is authored, before code tries to supply a value.

An intersection instead builds a type expression whose values must satisfy every constituent. The alias can be written even when the requirements make a useful value impossible; the consequences appear when code attempts to create, assign, or use such a value. The Handbook cautions that intersections with different property types can have unexpected results when used.

Declaration merging is a related but separate mechanism. The Handbook also documents errors for duplicate non-function interface members with different types during declaration merging, but that rule concerns repeated declarations of the same interface name—not the semantics of extends or &. See TypeScript Handbook: Declaration Merging.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose based on the contract you mean

  • Use interface extends to build a named object contract from compatible interfaces, especially when you want an incompatible inherited member rejected at the point of composition.
  • Use & when the intended meaning is that a value satisfies all the constraints, or when you need a type expression that is not represented by interface extension.
  • Inspect overlapping keys before intersecting. For each shared property, ask whether one value can meet both declarations. If not, make the declarations compatible, model the alternatives as a union, or transform the type explicitly—for example, with Omit followed by a replacement property.

These are not interchangeable style choices, and neither syntax is universally preferable. The right one follows from whether you want an interface contract whose inherited members must be coherent, or a type requiring simultaneous satisfaction of every constituent.

For the formal meaning and additional examples of intersections, see the Object Types and Unions and Intersection Types sections of the TypeScript Handbook.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.