I wrote such object literal in TypeScript:
var object = {
message: "Say",
say: () => {
return this.message;
}
};
And I got such generated JavaScript:
var object = {
message: "Say",
say: function () {
return _this.message;
}
};
Shouldn’t there be such line before return statement:
var _that = this;
as I am using arrow function expression?
You’re correct. It’s missing the :
This is discovered after the release(0.8) and is currently fixed on the developer branch.
Note:
Also I think you wanted to write
which will actualy print Say when it’s run.
See: http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax