Closed
Description
Please see following:
class A {
name: String = 'test A';
constructor() {
console.log(this.name);
}
}
class B extends A {
name: String = 'test B'
}
new B(); // 'test A'
It will return 'test A', but 'test B' is more obvious output for this code. And also it is very handy to have an ability to override property default value in subclasses.
It cam be easily achieved, if implicit super() call on B will be made after property assignment, just compile to this:
...
function B() {
this.name = 'test B';
_super.apply(this, arguments);
}
...
instead of this:
...
function B() {
_super.apply(this, arguments);
this.name = 'test B';
}
...
You can see example here: http://bit.ly/1cjaMeJ