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

Discussão em 'Angular' iniciado por PARAMANANDA PRADHAN, Outubro 19, 2024.

  1. I am facing a Typescript compilation error in my Angular app. Following is the sample code and error message.

    Would you please guide me to suppress this error. I think this code is correct as per the Javascript.

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


    export class A {
    foo: string;
    }

    export class B extends A {
    f1;
    set foo(name) {
    this.f1 = name;
    }
    get foo() {
    return this.f1;
    }
    }


    Editor's note: in the comments it emerged that both classes A and B are in third-party libraries.

    Continue reading...

Compartilhe esta Página