TS2611: 'foo' is defined as a property in class 'A', but is overridden here in 'B' as an accessor

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;
}

If you're really sure that your implementation is correct then you can disable the check by putting // @ts-nocheck line at the top of the ts file. @ts-nocheck in TypeScript Files