As shown in this example, the assignment to a
and defining b
results in different function type.
export module A {
export class Test {
constructor(){}
a =(x) => { return Math.sin(x); }
b (x) : any { return Math.sin(x); }
}
}
this results in following js
var Test = (function () {
function Test() {
this.a = function (x) {
return Math.sin(x);
};
}
Test.prototype.b = function (x) {
return Math.sin(x);
};
return Test;
})();
but, I am bit confused about the spec 4.9.2 Arrow Function Expressions
Thus, the following examples are all equivalent:
(x) => { return Math.sin(x); }
(x) => Math.sin(x)
x => { return Math.sin(x); }
x => Math.sin(x)
so, is there a way to use the arrow operator and define a function on the prototype. something like,
c(x) => Math.sin(x)