TS2515

error TS2515: Non-abstract class ‘Dog’ does not implement inherited abstract member ‘makeNoise’ from class ‘Animal’.

Bad Code ❌

1
2
3
4
5
abstract class Animal {
abstract makeNoise(): string;
}

class Dog extends Animal {}

Fixed Code ✔️

If we derive a class from an abstract class, then we have to provide an implementation for all its abstract members:

1
2
3
4
5
6
7
8
9
abstract class Animal {
abstract makeNoise(): string;
}

class Dog extends Animal {
makeNoise(): string {
return 'Woof!';
}
}

Video: https://youtu.be/62J_eQsK0e0?t=708