Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesUse extends to define a new interface that reuses members from one or more base interfaces. Use declaration merging when separate declarations with the same interface name are intentionally meant to contribute to one combined type—especially when you need to augment a library or global interface you cannot edit. Merging changes what TypeScript knows; it does not add JavaScript behavior.
Extension and merging solve different problems
With extension, you create a distinct interface and state its relationship to existing interfaces:
interface Identified {
id: string;
}
interface User extends Identified {
displayName: string;
}
User is a new name whose members include those of Identified plus displayName. An interface can extend more than one interface. Choose this when you own the API shape and want a clear derived contract. See the TypeScript Handbook’s object types and interface documentation.
Declaration merging works by name: separate declarations of the same interface are combined into one definition. As the TypeScript Handbook explains, merging means the compiler combines separate declarations declared with the same name. This is useful when the intended result is to add members to an existing named interface, rather than define a separate derived interface.
#1 Best Overall
Choose the mechanism that matches the target
| Situation | Use | Why |
|---|---|---|
| You control a new API shape and want it to reuse one or more base interfaces. | Extension | A separately named interface makes the relationship explicit without changing the original interface for every consumer. |
| A third-party module provides a runtime capability, but its existing named export lacks the corresponding type declaration. | Module augmentation | Augment the existing exported interface so its type describes the capability; the runtime patch must also be supplied and loaded. |
| A runtime environment provides a global capability that needs type support. | Global augmentation | Declare the added members on the existing global interface, provided the runtime really supplies them. |
| You are composing or specializing a type in code you control. | Usually extension | A distinct name avoids silently changing the shape associated with a shared interface name. |
Use augmentation to describe an existing runtime extension
For a module augmentation, target the actual module specifier and named export used by the package. The Handbook’s example augments a named Observable<T> export to describe a map method. The declaration describes the existing export; it does not implement the method.
If the runtime library adds the method by patching a prototype, that code must exist independently and be loaded where needed. The Handbook’s example separately assigns Observable.prototype.map and augments the type declaration. Without the runtime implementation, TypeScript may accept a call that fails when executed.
Rank #2
- 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
For a global extension, place an augmentation inside a module, for example:
export {};
declare global {
interface Window {
appFeature: string;
}
}
Include the declaration file in the TypeScript program, and add the field only if the application or environment actually initializes it. A type declaration is not a runtime initializer.
Know the limits of same-name declarations
Conflicting properties are errors
When declarations merge, duplicate non-function members must be compatible. Declaring the same property with incompatible types is rejected by the compiler; merging is not a way to override a property’s type.
Function overload order matters
Repeated function members contribute overloads. Overloads from later interface declarations take precedence over those from earlier declarations in the merged overload list, so declaration order can affect overload resolution.
Augmentation patches existing declarations only
Module augmentation targets a module TypeScript can resolve through ordinary module-specifier resolution. It can add to existing declarations, but cannot introduce new top-level declarations, and it cannot augment a default export. Global augmentation has the same patch-only boundary: it extends an existing global declaration rather than creating a new unrelated declaration.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Do not confuse extension with implementation
extends describes a type relationship between interfaces; implements checks whether a class satisfies an interface contract. Neither declaration mechanism generates JavaScript implementation. Use extension for a new related interface, merging for intentional contributions to an existing interface name, and separate runtime code whenever the added capability must actually run.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallQuick Recap
Best Value
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.




