The error message is correct as there is a subtle bug here. When you define a property in a parent class, the property is created automatically for every one of its sub-classes.
So, in the code you wrote, had you not written for class B: set/get foo(name) { ... } the class would have had the foo property anyway since the property is declared in B‘s parent class – A.
In your code you’re actually clobbering the foo property declared in A with the accessor declarations.
If you want to require all sub-classes of A to declare their own foo property (similar to an interface), then try:
export class A {
abstract foo: string;
}