October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How TypeScript Handles Duplicate Properties in Interface Extension and Intersections

TypeScript handles duplicate properties differently in interface extension, intersections, and declaration merging. Learn when conflicts are errors and when both types apply.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

TypeScript does not treat a repeated property as “last declaration wins.” When an interface extends another interface, the child property must remain compatible with the inherited contract or TypeScript reports an error. With an intersection (&), both property types apply at once; they are not alternatives. Repeated interface declarations with the same name are a third case—declaration merging—with its own rules.

What happens when an interface extends another interface?

An interface extension describes a subtype relationship. A child can redeclare a property only if the resulting member is compatible with the inherited one; it cannot silently replace the base type. The TypeScript Handbook explains that incompatible same-name properties in interface composition produce an error: Object Types.

interface Base {
  value: string;
}

interface Child extends Base {
  value: number; // Error: incompatible with Base.value
}

The important point is compatibility, not whether the two types seem related by name or intent. TypeScript uses structural type compatibility, and assignment compatibility is the practical rule in many contexts, including extends clauses. See the Type Compatibility handbook page.

A compatible redeclaration can preserve the inherited contract. More subtle cases—such as optionality or narrower property types—depend on the types involved and the compiler version, so avoid assuming that every apparently narrower declaration is accepted.

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

What happens to duplicate properties in an intersection?

An intersection means a value must satisfy both constituent types. If both sides declare the same property with different types, TypeScript does not choose one side: the property must meet both requirements. The handbook describes differently typed properties as being merged automatically in an intersection, which can lead to unexpected results when the type is used: Object Types.

type Both = { value: string } & { value: number };

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

For ordinary values, no value is both a string and a number, so this property is effectively impossible to satisfy. That does not mean every conflicting intersection reduces as a whole to never. In particular, conflicting literal discriminants can cause the entire intersection to reduce; other conflicts may leave the intersection type present while making a property or assignment unusable. TypeScript 3.9 also documented stricter checks for intersections of concrete object types involving properties and optional properties; consult the version-specific TypeScript 3.9 release notes for that historical change.

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

Intersections are useful when types contribute compatible or distinct properties:

type Response = { data: string } & { requestId: string };

Here a value needs both data and requestId. The Unions and Intersection Types handbook page shows this composition pattern for combining shared and specific requirements.

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

How is declaration merging different?

Two interface declarations with the same name are not an extension or an intersection. TypeScript merges them into one interface. For non-function members, duplicate names must have the same type; members with different types are an error. Same-name function members can instead contribute overload signatures, with later declaration groups generally placed before earlier ones. These rules are described in the handbook’s Declaration Merging section.

interface Settings {
  mode: string;
}

interface Settings {
  mode: string; // same type, so it can merge
  debug: boolean;
}

This is useful context when reading declarations from multiple files or libraries: sharing an interface name intentionally opens it to merging. A type alias cannot be reopened in the same way. The older TypeScript 2.0 release notes explain that identical duplicate identifiers across declaration blocks are allowed, while duplicate definitions inside one block remain disallowed; that historical note does not permit conflicting same-block properties.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Which composition should you use?

Choice What a duplicate property means Use it when
interface Child extends Base The child member must be compatible with the inherited member; an incompatible declaration is reported as an error. You are modeling a named subtype relationship.
A & B The value must meet both property requirements; neither side overrides the other. You are composing independent, compatible or distinct requirements.
Repeated interface declarations Declarations merge. Duplicate non-function members must have the same type; function members can form overloads. You intentionally want an interface to be augmented across declaration blocks.

For an intentional property replacement, first remove the original key and then add the new one, rather than relying on an intersection to override it. For example, Omit can express the transformation:

interface Base {
  value: string;
  id: number;
}

type WithNumericValue = Omit<Base, "value"> & { value: number };

This constructs a new type without Base.value, then adds the replacement. Check the result with the TypeScript version used by your project, especially when optional properties or other compatibility-sensitive members are involved. The handbook’s Object Types discussion covers interface extension and intersection behavior.

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

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 *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. 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…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.