How to avoid hard coded this? in Decorators
问题 I have read "How to implement a typescript decorator?" and multiple sources but there is something that i have nor been able to do with decorators. class FooBar { public foo(arg): void { console.log(this); this.bar(arg); } private bar(arg) : void { console.log(this, "bar", arg); } } If we invoke the function foo : var foobar = new FooBar(); foobar.foo("test"); The object FooBar is logged in the console by console.log(this); in foo The string "FooBar {foo: function, bar: function} bar test" is