TypeScript Version: 2.6.1
Code
class A {}
if (true) {
class B extends A {}
const foo = function () {
new B();
}
}
Expected behavior:
Should work as intended.
Actual behavior:
This translates into:
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var A = /** @class */ (function () {
function A() {
}
return A;
}());
if (true) {
var B_1 = /** @class */ (function (_super) {
__extends(B_1, _super);
function B() {
return _super !== null && _super.apply(this, arguments) || this;
}
return B;
}(A));
var foo = function () {
new B_1();
};
}
This is problematic, especially the following line towards the end:
B, the "constructor" should be extended. Not B_1, the "class" (which has a different name here for some reason, maybe that's part of the problem) as B_1 is not yet defined here.
This causes the parsing to fail.
TypeScript Version: 2.6.1
Code
Expected behavior:
Should work as intended.
Actual behavior:
This translates into:
This is problematic, especially the following line towards the end:
B, the "constructor" should be extended. NotB_1, the "class" (which has a different name here for some reason, maybe that's part of the problem) asB_1is not yet defined here.This causes the parsing to fail.