- Error
- Reported by the type checker
TS1253
Abstract properties can only appear within an abstract class.
An abstract property is declared in a class that isn't abstract. Mark the class `abstract`, or give the property a value.
What it means
Like abstract methods, abstract properties are only allowed in an abstract class, since something must subclass it and provide the value.
Example
export class Config {
abstract name: string;
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,3): error TS1253: Abstract properties can only appear within an abstract 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
- Mark the class
abstract. - Or remove
abstractand initialise the property.