Suggest an editImprove this articleRefine the answer for “Type and interface inheritance”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **type** cannot directly inherit from an interface via `extends`, but it can extend it through an intersection (`&`), which is effectively equivalent to inheritance. An **interface**, on the other hand, can inherit from a type via `extends`, but only if the type describes an object. **Key point:** the `type -> interface` direction only works through `&`, while `interface -> type` works directly through `extends` when the type is an object type.Shown above the full answer for quick recall.Answer (EN)Image### 1. Can a **type** inherit from an **interface**? **Not directly.** Types (`type`) do not support the `extends` keyword at creation, that is, you cannot write this: ```javascript interface A { name: string; } type B extends A = { age: number }; // Error ``` But you can **combine a type and an interface through an intersection (**`&`**)**, which is essentially **equivalent to inheritance**: ```javascript interface A { name: string; } type B = A & { age: number }; // Works ``` So a **type does not "inherit" an interface**, but it **can extend it** using `&`. --- ### 2. Can an **interface** inherit from a **type**? **Yes, if the type is an object structure.** TypeScript lets an interface inherit from a type through `extends`, **but only if the type describes an object** (not a primitive, a union, etc.): ```javascript type A = { name: string }; interface B extends A { age: number; } const obj: B = { name: "Tim", age: 25 }; // Works ``` But if the type is not an object (for example, a union or a primitive), there will be an error: ```javascript type C = string | number; interface D extends C {} // Error: an interface can only inherit object types ``` --- ### Summary | Option | Can it inherit? | Example | Alternative | |---|---|---|---| | **type → interface** | No, not directly | `type B extends A` (error) | `type B = A & { ... }` (works) | | **interface → type** | Yes, if type is an object | `interface B extends A {}` (works) | - |For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.