TS2720

error TS2720: Class ‘Dog’ incorrectly implements class ‘Animal’. Did you mean to extend ‘Animal’ and inherit its members as a subclass?   Property ‘makeNoise’ is protected but type ‘Dog’ is not a class derived from ‘Animal’.

Bad Code ❌

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

Fixed Code ✔️

The implements keyword is reserved to implement interfaces. If you want to work with class inheritance, you have to use extends:

1
2
3
4
5
class Dog extends Animal {
protected makeNoise(): string {
return "Woof!";
}
}

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