- Error
- Reported by the type checker
TS1243
'{0}' modifier cannot be used with '{1}' modifier.
Two modifiers that can't be combined are on the same declaration, for example `abstract` with `private` or `static`. Remove one.
What it means
Some modifiers contradict each other. An abstract member must be implemented by a subclass, so it can't be private (subclasses can't see it), static or async, and a readonly member can't be an accessor. The message names both modifiers.
Example
export abstract class Shape {
private abstract area(): number;
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,11): error TS1243: 'private' modifier cannot be used with 'abstract' modifier.
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 one of the two modifiers. For abstract members, use
protectedinstead ofprivate.