-
Couldn't load subscription status.
- Fork 13.1k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeBugA bug in TypeScriptA bug in TypeScriptES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
ES6 disallow to use this before super call.
class Aaa {
constructor(v: () => number) {
}
}
class Bbb extends Aaa {
vv: number;
constructor() {
this.vv = 111;
super(this.vvv);
}
vvv(): number { return 0; }
}
The line "this.vv = 111;" must be after super statement.
The super statement also cannot contain this usage.
Compilation to ES6 gives:
class Aaa {
constructor(v) {
}
}
class Bbb extends Aaa {
constructor() {
this.vv = 111;
super(this.vvv);
}
vvv() { return 0; }
}
So even if TS wants to relax "this usage before super" (which i doubt), then it must fix in generated ES6 code.
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeBugA bug in TypeScriptA bug in TypeScriptES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue