NoHomey / bind-decorator

The fastest automatic method.bind(this) decorator
MIT License
68 stars 11 forks source link

question: Does this decorator bind to the class instance, or to its prototype? #10

Open SanderElias opened 6 years ago

SanderElias commented 6 years ago

The [ts docs]() mention:

Either the constructor function of the class for a static member, or the prototype of the class for an instance member.

As a long time JS user, this continues to confuse me;) For classes you only create a single instance from, this is a non-issue. However, if you create multiple instances of the same class, this might turn out to be the wrong this, and create very hard to find bugs.