• Error
  • Reported by the type checker

TS2417

Class static side '{0}' incorrectly extends base class static side '{1}'.

The static side of a class doesn't fit the static side of its base class. Make overridden static members compatible with the base ones.

What it means

A class constructor inherits the base constructor's static members. A static property or method redeclared with an incompatible type breaks code that uses the subclass where the base class constructor is expected.

Example

index.ts
class Model {
  static table: string = "models";
}
export class User extends Model {
  static table: number = 1;
}
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(4,14): error TS2417: Class static side 'typeof User' incorrectly extends base class static side 'typeof Model'.
  Types of property 'table' are incompatible.
    Type 'number' is not assignable to type 'string'.

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

  • Give the static member the same (or a compatible) type as in the base class.
  • Rename it if it means something else in the subclass.