What is the difference between an interface and a type alias in TypeScript? What do extends and implements mean?
Show the explanation
Model answer. Both describe the shape of objects, and for most object types they are interchangeable.
- `interface` describes object and class shapes; it can be reopened (declaration merging) and extended with
extends. - `type` can name any type: unions (
'asc' | 'desc'), tuples, primitives, mapped and conditional types. It cannot be reopened.
interface Person { name: string }
interface Employee extends Person { empId: number } // interface inheritance
type Status = 'active' | 'blocked'; // only possible with type
type Admin = Employee & { permissions: string[] }; // intersection
interface Payable { pay(amount: number): void }
class Contractor implements Payable { // class promises to match
pay(amount: number) { console.log(`paid ${amount}`); }
}- `extends`: one interface (or class) inherits members from another.
- `implements`: a class promises to satisfy an interface; it inherits nothing, and the compiler only checks the class.
A common team convention: interface for object shapes and public APIs, type for unions and compositions.
Original UniCircle question. Last reviewed 22 Oct 2026.
