wycats / javascript-decorators

2.4k stars 127 forks source link

Method decorated haven't access to the property 'this' of the constructor #81

Closed wzalazar closed 7 years ago

wzalazar commented 7 years ago

Hi, I need help with this. This is my problem...

@decoratorClass
export default class User {
    constructor(name) {
        this.name = name;
    }

  @decoratorMethod 
  method() {
     console.log(this.name) //is undefined, why??
  }
}

I don't know if is a bug or is not supported yet. Thank' s.

loganfsmyth commented 7 years ago

There is likely a bug in whatever decoratorMethod is, so more info would be needed.

wzalazar commented 7 years ago

Sorry, I created unit test for this case and disappeared the issue. Thanks for all.