43fc19c958
* Emit statements before super When statements come before super, Typescript's emit is incorrect, whether there is an error or not. This change preserves statements that come before super whether there is an error or not. Here is the case with no errors: ```ts class Test extends Array { p: number constructor() { console.log("p is initialised in the constructor below super()") super() this.p = 1 } } ``` Notice that `p` is manually initialised in the constructor after `super()` instead of at the property declaration. * Update baselines Parameter properties in the error case now move below the super call. This is an improvement because it means the code is more likely to execute correctly. * remove outdated comments
23 lines
373 B
TypeScript
23 lines
373 B
TypeScript
// @useDefineForClassFields: true
|
|
// @target: es2015
|
|
|
|
class Base {
|
|
}
|
|
class Sub extends Base {
|
|
// @ts-ignore
|
|
constructor(public p: number) {
|
|
console.log('hi');
|
|
super();
|
|
}
|
|
field = 0;
|
|
}
|
|
|
|
class Test extends Base {
|
|
prop: number;
|
|
// @ts-ignore
|
|
constructor(public p: number) {
|
|
1;
|
|
super();
|
|
this.prop = 1;
|
|
}
|
|
}
|