规范提到以下函数将用于扩展:
var __extends = this.__extends || function(d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function f() { this.constructor = d; }
f.prototype = b.prototype;
d.prototype = new f();
}
然而,目前生成的函数是:
var __extends = this.__extends || function (d, b) {
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
这打破了静态继承:
class A{
fooMem=10;
static fooStat=10;
}
class B extends A{};
var b = new B();
alert(b.fooMem.toString());
alert(B.fooStat.toString());
如果使用文档提到的扩展函数,那将会有效:Test
有人知道没有使用文档提到功能的原因吗?