Reputation: 2958
Both Typescript and Traceur compile ES6 down to ES5 right, so what's the need for traceur-runtime? Secondly, why's there no typescript-runtime?
PS: I read that traceur-runtime shims the "missing" functions, and also does more than that and provides helper functions that are used by some features, but i'm not sure what that really means
Upvotes: 2
Views: 198
Reputation: 275947
Secondly, why's there no typescript-runtime
It assumes that the user will add the stuff they need themselves e.g. if you are using promises it assumes that your runtime has it.
For other stuff like class inheritance it provides helpers inline e.g. :
class Base{ }
class Child extends Base { }
generates (notice __extends
):
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var Base = (function () {
function Base() {
}
return Base;
})();
var Child = (function (_super) {
__extends(Child, _super);
function Child() {
_super.apply(this, arguments);
}
return Child;
})(Base);
Upvotes: 2