I am attempting to modify a property from a parent class and then invoke the original version of that property within the modification (using TypeScript playground):
class A {
public get a(): number {
return 1;
}
}
class B extends A {
public get a(): number {
return super.a + 1; // error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
}
}
However, I encounter an error from the TypeScript compiler:
error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
Is there a way to override a property of a base class and still access the original property from the override?