Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter Properties transform: SWC vs TS (initializer relocation) #3

Closed
robpalme opened this issue Aug 11, 2024 · 4 comments
Closed

Comments

@robpalme
Copy link

@marco-ippolito requested I raise this issue here due to SWC Parameter Properties differing from TS Parameter Properties.

With modern ES2022/ESNext emit, where by default it is implied that useDefineForClassFields: true, TS does not relocate class field initializers when Parameter Properties are used. But SWC does. So if support for the Parameter Properties transform is added in nodejs/node#54283 then Node needs to pick which behavior it wants.

@marco-ippolito
Copy link
Member

marco-ippolito commented Aug 11, 2024

I'm also wondering if changing the behavior in the future will result in a breaking change in Node.js @nodejs/typescript?

@robpalme
Copy link
Author

Thanks to @magic-akari, SWC now provides an option (jsc.transform.native_class_properties) to match TS behavior in SWC v1.7.11 which was released one hour ago.

@marco-ippolito
Copy link
Member

amaro v0.1.6 ship the updated version. Updating in core, and adding the flag in a followup PR nodejs/node#54374

@robpalme
Copy link
Author

This is now fixed in Node core so I am happy to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants