• Error
  • Reported by the type checker

TS4112

This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class.

A member has the override modifier but its class doesn't extend another class. Remove override, or add the missing extends.

What it means

override says the member replaces one from a base class. A class with no extends clause has no base class, so nothing can be overridden.

Example

index.ts
class Logger {
  override log() {}
}
export {};
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(2,12): error TS4112: This member cannot have an 'override' modifier because its containing class 'Logger' does not extend another class.

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

  • Remove override.
  • Or add the extends clause you meant to write.