interface Animal { name: string }
interface Dog extends Animal { breed: string }
const d: Dog = { name: 'Rex', breed: 'Labrador' }Interface extends inherits all properties from a base interface and adds new ones.
An interface can extend another to inherit its properties, then add more.
Challenge: Implement createDog(name, breed) returning a Dog that extends Animal.
createDog('Rex', 'Lab') // β { name: 'Rex', breed: 'Lab', sound: 'woof' }