For object shapes, declare an interface with extends: interface User extends Entity { email: string }. The base can be an interface or a type alias, and you can list several: extends Entity, Named. With a type alias, use an intersection instead: type User = Entity & { email: string }, which is also the only way to extend a union. To change a property's type, extend Omit<Entity, "id"> and declare it again.
TypeScript has two ways to name an object type, interface and type, and each has its own way to build on another type: extends for interfaces, the & intersection operator for type aliases. For plain object shapes they produce the same result and you can mix them freely, so most of the "interface vs type" question comes down to the edges: what happens when a property conflicts, which one can extend a union, and which one can be reopened later. The sections below cover extends, intersections, conflicting properties, replacing a property's type with Omit, and declaration merging, then sum up when to pick each. Each example runs on this page: hit Run, then edit the code and run it again.
1interface extendsRecommended
interface User extends Entity gives User every member of Entity plus the ones in its own body. The base doesn't have to be an interface: any object type works, including a type alias such as Named below. List several bases with commas, and extend the result again: Admin builds on User, and because it has every member a User has, an Admin is accepted anywhere a User is.
// A base shape, written as an interface or as a type alias: both work interface Entity { id: number; createdAt: string; } type Named = { name: string; }; // extends copies every member of the bases and adds its own interface User extends Entity, Named { email: string; } // Extend the extended interface again interface Admin extends User { role: "admin"; permissions: string[]; } function describe(user: User): string { return `#${user.id} ${user.name} <${user.email}>`; } const ada: User = { id: 1, createdAt: "2026-11-01", name: "Ada", email: "[email protected]", }; const grace: Admin = { id: 2, createdAt: "2026-11-02", name: "Grace", email: "[email protected]", role: "admin", permissions: ["deploy", "billing"], }; // An Admin is a User, so it fits wherever a User is expected for (const u of [ada, grace]) { console.log(describe(u)); } console.log(grace.permissions.join(", ")); console.log(Object.keys(grace));
Output
describe takes a User and happily prints the admin too: #2 Grace <[email protected]>. The last line shows that extending is purely a type-level idea: at runtime grace is one flat object, [ 'id', 'createdAt', 'name', 'email', 'role', 'permissions' ], with no link to a base object or class. Nothing is inherited when the code runs; the checker only makes sure each object literal has every member its type asks for.
2Type aliases: intersect with &
A type alias has no extends clause. You build on another type with an intersection, A & { … }: a value of the result must satisfy both sides, so it has all their members. The left side can be an interface, as Entity is here. Intersections also do what interfaces can't: Payment is a union of two shapes, and Payment & { orderId: string; total: number } adds the order fields to each member of the union, so checking order.method still narrows to the card or the transfer.
interface Entity { id: number; createdAt: string; } // & combines the members of both sides into one type type UserEvent = Entity & { userId: string; action: "login" | "logout"; }; // Only a type alias can extend a union: & distributes over each member type Payment = | { method: "card"; last4: string } | { method: "iban"; iban: string }; type Order = Payment & { orderId: string; total: number }; function label(order: Order): string { // The method check narrows to one member of the union if (order.method === "card") { return `${order.orderId}: ${order.total} by card ending ${order.last4}`; } return `${order.orderId}: ${order.total} by transfer from ${order.iban}`; } const login: UserEvent = { id: 7, createdAt: "2026-11-19T08:00:00Z", userId: "u-42", action: "login", }; console.log(JSON.stringify(login)); const orders: Order[] = [ { orderId: "A-1", total: 25, method: "card", last4: "4242" }, { orderId: "A-2", total: 90, method: "iban", iban: "DE89 3704" }, ]; orders.forEach((o) => console.log(label(o)));
Output
Try the interface version, interface Order extends Payment, and the build stops with error TS2312: An interface can only extend an object type or intersection of object types with statically known members. A union isn't a single object type, so only & works there. If you copy the Stack Overflow example that names its base type Event, rename it: in a file without import or export it collides with Node's global Event and fails with error TS2300: Duplicate identifier 'Event'.
3When an extended property conflicts
The two forms part ways when the new type redeclares a member with an incompatible type. Here the base says id: number and the extension wants id: string. An interface checks this at the declaration, so the build fails before any value is created. This embed fails on purpose: the type error stops the run.
interface Product { id: number; price: number; } // The id coming back from a new API is a string, so we try to change it interface ApiProduct extends Product { id: string; } const p: ApiProduct = { id: "sku-1", price: 9.5 }; console.log(p.id);
Output
The compiler reports error TS2430: Interface 'ApiProduct' incorrectly extends interface 'Product'. and explains it on the next two lines: Types of property 'id' are incompatible. and Type 'string' is not assignable to type 'number'. The intersection type ApiProduct = Product & { id: string } compiles without a word: it combines the two id types into string & number, which no value can have, so ApiProduct["id"] is never. You only find out when you build a value, far from the cause: error TS2322: Type 'string' is not assignable to type 'never'. That early, specific error is a good reason to prefer extends for object types. To change the type on purpose, see the next section.
4Change a property type with Omit
To replace a member with a different type, remove it first and then declare it again: interface ApiProduct extends Omit<Product, "id"> { id: string }. Omit returns an object type without id, so there is nothing left to conflict with. The type-alias form is Omit<Product, "id"> & { id: string }, and the two are interchangeable. When the new type is a subtype of the old one, such as a tuple that must start with "featured" where the base has string[], plain extends accepts the redeclaration without Omit.
interface Product { id: number; price: number; tags: string[]; } // Drop the member first, then declare it again with the new type interface ApiProduct extends Omit<Product, "id"> { id: string; } // The same thing as a type alias type ApiProduct2 = Omit<Product, "id"> & { id: string }; // Narrowing a member to a subtype needs no Omit interface FeaturedProduct extends Product { tags: ["featured", ...string[]]; } function toApi(p: Product): ApiProduct { return { ...p, id: `sku-${p.id}` }; } const lamp: Product = { id: 7, price: 39.9, tags: ["home"] }; const fromApi: ApiProduct2 = toApi(lamp); const hero: FeaturedProduct = { id: 8, price: 99, tags: ["featured", "sale"] }; console.log(fromApi); console.log(typeof lamp.id, typeof fromApi.id); console.log(hero.tags[0]);
Output
toApi spreads the product and overwrites id, and the output number string shows the two types of id side by side. The spread copies every other member, so price and tags come along unchanged. For Omit, Pick and Partial in more depth, see omit a property from a type.
5Declaration merging: only interfaces reopen
The one feature that only interfaces have: declaring an interface a second time with the same name doesn't replace it, it adds members to it. The two Settings declarations below merge into one type with both theme and fontSize. The same mechanism extends types you don't own, such as the built-in Array<T> or a library's options interface: declare the interface again with the extra member, then supply the implementation yourself.
// Two declarations of the same interface merge into one interface Settings { theme: "light" | "dark"; } interface Settings { fontSize: number; } const settings: Settings = { theme: "dark", fontSize: 14 }; console.log(settings); // The same mechanism adds members to built-in types. This file has no // import or export, so its declarations are global and merge with lib's interface Array<T> { last(): T | undefined; } // The type only describes the method: the code still has to add it Array.prototype.last = function <T>(this: T[]): T | undefined { return this[this.length - 1]; }; const sizes: number[] = [12, 14, 16]; const top = sizes.last(); console.log(top, typeof top); console.log([].last());
Output
sizes.last() is typed number | undefined and prints 16 number; on an empty array it prints undefined. Two type Settings aliases fail instead, with error TS2300: Duplicate identifier 'Settings'. on each, and merged interfaces may not disagree on a member: error TS2717: Subsequent property declarations must have the same type. Property 'fontSize' must be of type 'number', but here has type 'string'. Merging is powerful but global: in a module (a file with import or export) the built-in augmentation has to go inside declare global, and patching a prototype affects every array in the program, so prefer a plain helper function in shared code.
6Interface or type: which should you use?
For an object shape, start with an interface and extends: it reports conflicts at the declaration, its errors name the interface, and the TypeScript team's performance guide recommends interfaces over intersections because the checker caches the relationship. Reach for a type alias when the type isn't a single object shape: unions, function types, tuples, mapped and conditional types, or an object type built from one of those.
| Method | Can extend | Conflicting member | Best for |
|---|---|---|---|
| interface B extends A | Interfaces, object type aliases | Error TS2430 at once | Object shapes: the default |
| type B = A & { … } | Anything, unions too | Silent never | Unions, mapped and generic types |
| extends Omit<A, "k"> | Object types | Replaced on purpose | Changing a member’s type |
| interface A { … } again | Only an interface of the same name | Error TS2717 | Adding to global or library types |
Frequently asked questions
Should I use an interface or a type alias in TypeScript?
For object shapes either works, and you can extend one with the other. Prefer an interface with extends: a conflicting property is an error at the declaration (TS2430) instead of a silent never, and the checker handles interface hierarchies faster than large intersections. Use a type alias for anything that is not one object shape: unions, function types, tuples, mapped and conditional types. Whichever you pick, be consistent within a project.
Can a type alias extend an interface, and the other way round?
Yes. A type alias extends an interface with an intersection, type Admin = User & { role: string }, and an interface extends a type alias with extends, interface User extends Named { email: string }, as long as the alias is an object type. Mixing the two is common and costs nothing.
Why do I get "An interface can only extend an object type or intersection of object types with statically known members"?
The type after extends is a union (or another type whose members are not fixed, such as a generic parameter). An interface needs one known set of members. Use a type alias with an intersection instead: type Order = Payment & { orderId: string } adds the fields to every member of the union and keeps narrowing on the discriminant working.
Can a class implement a type alias?
Yes, implements accepts an interface or a type alias that is an object type, such as type Shape = { area(): number }. A union fails with error TS2422: A class can only implement an object type or intersection of object types with statically known members. Note that implements only checks the class against the type; unlike class B extends A, it copies no code into the class.
How do I extend a generic interface?
Pass a type argument to the base like any other use of a generic: interface Paged<T> extends ApiResult<T[]> { page: number } forwards its own parameter, and interface UserResult extends ApiResult<User> { … } fixes it. With a type alias the same reads type Paged<T> = ApiResult<T[]> & { page: number }.
Run it yourself
Open any of these in the full TypeScript editor to tweak, run and share.
TypeScript playground