-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
When this code is compiled to ES5 on nightly (4.7.0-dev.20220419
)
class A {
public constructor() {
console.log("A")
}
}
class B extends A {
constructor() {
"ngInject";
console.log("B")
super();
}
}
const b = new B();
it results with:
"use strict";
var __extends = (this && this.__extends) || (function () {
/* implementation omitted for brevity */
})();
var A = (function () {
function A() {
console.log("A");
}
return A;
}());
var B = (function (_super) {
__extends(B, _super);
function B() {
"ngInject";
console.log("B");
_this = _super.call(this) || this;
return _super.call(this) || this;
}
return B;
}(A));
var b = new B();
In addition to _super.call(this)
being duplicated, this code also fails at runtime because _this is not defined
.
🔎 Search Terms
constructor, super, ngInject, directive, _this, this
🕗 Version & Regression Information
- This changed between versions 4.5.x and 4.6.x
I expect #29374 to have introduced this regression. The code compiles and runs correctly on 4.5.x.
#48671 looks semi-related and it's already been fixed, but my issue seems a bit different.
⏯ Playground Link
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue