0

I know there is some others questions with that subject, but my issue is not the same as them : I checked my class and I already use it the same way as them. I extends a class A into a class B, and I can't access to A public properties in B. Here is my (simplified) code :

export class A {
    propertyA: string;

    constructor() {
        this.propertyA = "some text";
    }
}

import {A} from "./A";
export class B extends A {

    constructor() {
        super();
    }


    static method() {
        console.log(this.propertyA);
    }
}
1
  • 1
    You need to read up of the difference between static and instance. Commented Jul 25, 2017 at 15:05

1 Answer 1

4

You cannot access this from a static method. Remove the static and it should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.