• Error
  • Reported by the type checker

TS2720

Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?

A class implements another class but doesn't match its members, often because it should have extended it. Use extends, or add the members.

What it means

implements with a class checks that this class has the same public shape as the other one, but doesn't inherit anything. When the shape doesn't match, the message suggests extends, which inherits the members instead.

Example

index.ts
class Animal {
  name = "";
  move() {}
}
class Dog implements Animal {
  name = "rex";
}
export {};
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(5,7): error TS2720: Class 'Dog' incorrectly implements class 'Animal'. Did you mean to extend 'Animal' and inherit its members as a subclass?
  Property 'move' is missing in type 'Dog' but required in type 'Animal'.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Use extends to inherit the base class's members: class Dog extends Animal.
  • Or keep implements and declare every member of the other class.