- Error
- Reported by the type checker
TS2512
Overload signatures must all be abstract or non-abstract.
Overloads of a method disagree on whether it is abstract. Mark every signature abstract, or none of them.
What it means
An overloaded method is one member, so either all of its signatures are abstract (and there's no implementation) or none are.
Example
export abstract class Reader {
abstract read(n: number): string;
read(): string;
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(3,3): error TS2512: Overload signatures must all be abstract or non-abstract.
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
- Add
abstractto every overload of the member. - Or remove it from all of them and add an implementation.