I propose to make "bind" keyword for class methods. This way you can bind "this" keyword to current class instance.
class Foo {
public bind someMethod(): void {
// Here .this is always current Foo instance
}
}
compiles to
var Foo = (function () {
function Foo() {
this.someMethod = this.someMethod.bind(this);
}
Foo.prototype.someMethod = function () {
};
return Foo;
})();