class A {
new(x: num) {}
}
class B extends A {
new() {
let x = 3 + 5;
super(x);
}
}
This happened:
error: Call to super constructor must be first statement in constructor
--> wing/main.w:8:5
|
8 | super(x);
| ^^^^^^^^^ Call to super constructor must be first statement in constructor
I expected this:
I expected the example to compile. This kind of code is supported in TypeScript:
class A {
constructor(foo: number) {}
}
class B extends A {
constructor() {
let x = Math.random();
super(x);
}
}
Is there a workaround?
No response
Anything else?
No response
Wing Version
0.73.13
Node.js Version
20.11.1
Platform(s)
MacOS
Community Notes
Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.
I tried this:
This happened:
I expected this:
I expected the example to compile. This kind of code is supported in TypeScript:
Is there a workaround?
No response
Anything else?
No response
Wing Version
0.73.13
Node.js Version
20.11.1
Platform(s)
MacOS
Community Notes