TS2377

Constructors for derived classes must contain a 'super' call.

Broken Code ❌

abstract class Animal {
  abstract name: string;
}
 
class Dog extends Animal {
  public name;
 
  constructor(name: string) {
    this.name = name;
  }
}

Fixed Code ✔️

Every constructor in a derived class has to call the super method to invoke the constructor of the base class. It has to be the very first call:

abstract class Animal {
  abstract name: string;
}
 
class Dog extends Animal {
  public name;
 
  constructor(name: string) {
    super();
    this.name = name;
  }
}

Video Tutorial