Reputation: 276255
The specification mentions that the following function will be used for extension :
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();
}
However the function generated currently is :
var __extends = this.__extends || function (d, b) {
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
This breaks static inheritance:
class A{
fooMem=10;
static fooStat=10;
}
class B extends A{};
var b = new B();
alert(b.fooMem.toString());
alert(B.fooStat.toString());
Which would work if the documentation mentioned extends function is used : Test
Anybody know the reason why the documentation mentioned function was not used?
Upvotes: 3
Views: 266
Reputation: 276255
It has been accepted as a bug: http://typescript.codeplex.com/workitem/825
Upvotes: 2