Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

@autobind doesn't work properly when calling super from the parent's parent's parent. #76

Open
JabX opened this issue May 10, 2016 · 4 comments

Comments

@JabX
Copy link

JabX commented May 10, 2016

Hello it's me again, from #69
Your fix worked for a super call on the parent's parent, but when I try to go even further up the chain I'm it still doesn't bind properly.
I'm sorry to bother you with such edge cases, but you'd be my hero if you could find a solution.
Thanks.

@jayphelps
Copy link
Owner

jayphelps commented May 11, 2016

Heard you like super from parent's parent's parent

image

@jayphelps
Copy link
Owner

jayphelps commented May 11, 2016

Can you provide some actual code I can use to reproduce? 💃

Also--this is in TypeScript again right?

@JabX
Copy link
Author

JabX commented May 11, 2016

Yup, still in Typescript.

Code would be like

@autobind
class A {
    method() {
          console.log(this.test);
    }
}

@autobind
class B extends A {
}

@autobind
class C extends B {
}

@autobind
class D extends C {
    test = 'hello';

    method() {
           super.method();
     }
}

@JabX
Copy link
Author

JabX commented Jul 21, 2016

I encoutered the issue again yesterday and it made me think that if the problem is really related to the way Typescript transpile classes down to ES5, you should be able to reproduce that with Babel with the "loose-class-transform" option. It essentially ditches the strictness of the default transpilation to something lighter that performs better and works on older browsers (I think it the default only works on IE 11), which is very similar to what Typescript does.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants