• Error
  • Reported by the type checker

TS2610

'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property.

A subclass declares a plain property where the base class has a getter/setter. Override it with an accessor, or rename the property.

What it means

A base class defines the member as an accessor (get/set) and a subclass redeclares it as an ordinary instance property. With class fields, the subclass's field replaces the accessor on each instance, so the base class's getter and setter would never run.

Example

index.ts
class Base {
  get size(): number { return 1; }
}
class Child extends Base {
  size = 2;
}
export {};
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(5,3): error TS2610: 'size' is defined as an accessor in class 'Base', but is overridden here in 'Child' as an instance property.

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

  • Override it with an accessor in the subclass: get size() { return 2; }.
  • Or rename one of the two members.