Extending Interfaces
Extending Interfaces
π¨βπΌ Interfaces can extend other interfaces, inheriting their properties. This
is cleaner than copying properties manually.
interface Animal {
name: string
}
interface Dog extends Animal {
breed: string
}
// Dog has both name and breed
const dog: Dog = { name: 'Rex', breed: 'German Shepherd' }
π¨ Open
and:
- Create a base
Entityinterface with common fields - Extend it to create
UserandProductinterfaces - Use multiple inheritance with
extends A, B


