01 / 05
The way you write extends has not changed
You inherit a parent class with the same class child extends parent as in JavaScript. You do not have to write the parent's fields again in the child.
The types come with them, so the name you read off a child instance is treated as a string.
class Animal { name: string; constructor(name: string) { this.name = name; }}class Dog extends Animal {}const dog = new Dog("Pochi");console.log(dog.name);Result
Pochi