change the `bound` example from this[name] = `this[name].bind(this)` to `this[name] = target.bind(this)` for supporting Private properties
PupilTong opened this issue · 0 comments
PupilTong commented
This works for me with typescript 5.4.5
function bound<T extends CallableFunction, P>(target: T, {addInitializer, name}: ClassMethodDecoratorContext<P>):void {
addInitializer(function (this: any) {
this[name] = target.bind(this);
});
}
class MyClass {
@bound
#myfoo() {
}
}