You are reading a single comment by @llakie and its replies. Click here to read the full conversation.
  • class A {
      constructor() {}
    }
    
    class B extends A {
      constructor() {
        super();
      }
    }
    
    class C extends B {
      constructor() {
        super();
      }
    }
    
    function onInit() {
      const c = new C();
    }
    

    Hi, I have a problem, which could be boiled down to the code snippet given above.
    If I run it on my Espruino WiFi (2v16), I get a recursion error, since if class B tries to call the constructor of A, it calls its own constructor.
    Does anyone has a workaround for this problem? I already tried passing different argument lists into the constructors to make them distinguishable (in C++ mapping terms at least). Without any luck. I can easily instantiate B or A, but not C.
    I would really appreaciate your help. Thank you very much.

About

Avatar for llakie @llakie started