Skip to content
Latchkey

TS2515: Non-abstract class does not implement abstract member - in CI

A concrete class extends an abstract class but does not implement one of its abstract members.

What this error means

Type-checking fails with TS2515 naming the abstract member the subclass left unimplemented.

tsc
src/shape.ts(10,7): error TS2515: Non-abstract class 'Circle' does not implement inherited abstract member 'area' from class 'Shape'.

Diagnose it: which tsconfig and which compiler?

A TypeScript error that appears only in CI usually means the runner is compiling with a different config or a different compiler version than your editor. Your editor uses the workspace TypeScript and the nearest tsconfig.json; CI uses whatever the lockfile resolved and whatever config the build script names.

Terminal
# what CI will actually use
npx tsc --version
npx tsc --showConfig | head -40

# which files are in the program (a missing include is a common cause)
npx tsc --listFiles | wc -l

# type-check only, no emit, same as most CI gates
npx tsc --noEmit

Common causes

How to fix it

Implement the abstract member

  1. Add the method/property with a matching signature in the subclass
ts
class Circle extends Shape {
  area(): number { return Math.PI * this.r ** 2 }
}

Keep the subclass abstract if intended

  1. If the class is not meant to be instantiated, declare it abstract too

Pin the compiler so unrelated updates cannot break the gate

TypeScript adds errors in minor releases. An unpinned compiler turns a routine dependency update into a red build on code nobody touched, which is the most common false alarm in a TypeScript CI pipeline.

package.json
// package.json
{
  "devDependencies": {
    "typescript": "5.6.3"   // exact, not ^5.6.3
  }
}

How to prevent it

  • Implement all abstract members when subclassing, or keep intermediate classes abstract.

Frequently asked questions

How do I fix TS2515: Non-abstract class does not implement abstract member?
There are 2 fixes depending on which cause you have: implement the abstract member and keep the subclass abstract if intended. Work through them in order, since the first is the most common.
What does TS2515: Non-abstract class does not implement abstract member actually mean?
Type-checking fails with TS2515 naming the abstract member the subclass left unimplemented.
How do I stop TS2515: Non-abstract class does not implement abstract member happening again?
Implement all abstract members when subclassing, or keep intermediate classes abstract.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card