Closed
Description
script.ts
class A extends B {}
class B { static foo() {} }
Produces broken js that throws subject exception
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function (_super) {
__extends(A, _super);
function A() {
_super.apply(this, arguments);
}
return A;
}(B));
var B = (function () {
function B() {
}
B.foo = function () { };
return B;
}());
We need to produce js like this
var __extends = (this && this.__extends) || function (d, b) {
if( Object.setPrototypeOf ) Object.setPrototypeOf( d , b )
else for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
function A() {
B.apply(this);
}
__extends(A, B);
function B() {
}
B.foo = function () { };
- This is short and clear code.
- This code are close to code writed by human.
- This works right in modern browsers.