-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(es/preset-env): Disable all class passes for target with native class support #9774
base: main
Are you sure you want to change the base?
Conversation
|
CodSpeed Performance ReportMerging #9774 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it in Babel's Playground. With native support for class fields, there are indeed no related transformations.
However, this raises concerns about TypeScript's useDefineForClassFields
option.
Does it work even for the targets with native class support? |
Yes, in TypeScript, even with native support for class fields, input: class Foo {
bar: any;
} "use strict";
// @useDefineForClassFields: true
// @target: esnext
class Foo {
bar;
} "use strict";
// @useDefineForClassFields: false
// @target: esnext
class Foo {
} |
Perhaps we should redesign the transformation options for the class fields; I suggest we include at least three options:
|
Maybe 1 and 3 would be enough? |
Description:
This is just PoC to ask for opinion @magic-akari. I think it sounds reasonable to disable all class properties transform where it's natively supported. So I made this, but I want to hear opinion about it.
Related issue: