You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Invalid execution of class inheritance by Test runner #21119
Code above consists mostly of classes and interfaces generated by NSwag. Wherever is extends the fields are set on this in super but are not exposed after we exit Model constructor.
This is especially weird because ts-node, TS REPL (and node for compiled JavaScript code) are executing the code without issues. The a.name contains expected value.
Turns out, this is a long-known issue between TypeScript and Babel. For example, see this issue: babel/babel#14291.
TypeScript introduced the useDefineForClassFields flag that makes it compatible with the newest spec, see details here.
We can probably allow declare modifiers, as outlined in the TypeScript release notes above. In this case a workaround would be declare name!: string | null that avoids generating this.name = void 0.
Unfortunately the workaround is not going to work for me (even if would be merged) as NSwag does not give the possiblity to generate TS with declare keyword in front of the field name. At least I can't see it in their configuration. And I would rather not write post-processing on generated 70 KLOC.
Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.
Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.
Activity
yury-s commentedon Feb 22, 2023
I can reproduce it.
yury-s commentedon Feb 22, 2023
Playwright transforms DemoA into this:
J-Sek commentedon Feb 23, 2023
Yury Semikhatsky (@yury-s) My tsconfig.json is configured for
"target": "es2015",and the output indistis plain and simple.Where can I inspect this code with
= void 0?And maybe by any chance you know whether it is described in docs or how to control this behavior?
dgozman commentedon Feb 28, 2023
Turns out, this is a long-known issue between TypeScript and Babel. For example, see this issue: babel/babel#14291.
TypeScript introduced the
useDefineForClassFieldsflag that makes it compatible with the newest spec, see details here.We can probably allow
declaremodifiers, as outlined in the TypeScript release notes above. In this case a workaround would bedeclare name!: string | nullthat avoids generatingthis.name = void 0.feat(typescript): allow `declare` for class properties (#21281)
dgozman commentedon Mar 2, 2023
With #21281, the workaround now is to use
declare name: string. See comment above for details.mxschmitt commentedon Mar 20, 2023
Fix got reverted since it regressed other behaviour. Keeping it open until a new fix is merged.
mxschmitt commentedon Mar 31, 2023
I filed babel/babel#15530 for it, since it looks like an upstream bug.
J-Sek commentedon Mar 31, 2023
Thanks, I will keep track of the upstream issue.
Unfortunately the workaround is not going to work for me (even if would be merged) as NSwag does not give the possiblity to generate TS with
declarekeyword in front of the field name. At least I can't see it in their configuration. And I would rather not write post-processing on generated 70 KLOC.pavelfeldman commentedon Nov 17, 2023
Why was this issue closed?
Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.
Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.