-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
transformer: tsc vs babel on enum transformation #8342
Comments
Confirmed that this weird behavior is also present in Babel. Babel REPL I am no TypeScript expert, so I may be wrong, but my understanding is: TSC is the "source of truth" on TypeScript transforms, and Babel's TS transform should replicate TSC's behavior. If it doesn't, then that's a bug in Babel. @branchseer May I suggest raising an issue on Babel? That would help "flush out" answer on whether they diverged from TSC for any good reason, or if it's simply a bug. |
issue logged for Babel: babel/babel#17049 |
Great! Thank you. #8508 updates our transformer test fixtures to latest from Babel, which includes the test case you added in babel/babel#17050 (obviously, that test is failing currently). I'll let @Dunqing come back on whether he plans to work on it, or if he has any thoughts, but as far as I'm aware he's currently working on other things, and a PR would be very welcome. |
Update babel submodule for conformance tests to latest HEAD. The test fixtures include a new one for a bug fix which @branchseer intends to also apply to Oxc - babel/babel#17050 (see #8342).
Discussed in #8341
Originally posted by branchseer January 8, 2025
oxc-transform currently follows babel's rules on enum transformation. IMHO it's a little bit weird about whether an identifier should be resolved to the enum member:
https://playground.oxc.rs/#eNqNkcFqwzAMhl9F+NIEwroOdunooD0Udhh7gVycREkNjlRsp11X8u6Tk6UbXRk7+Zcs/f+HfValWqqckiSF1TOccwI4aAdrWMFsh9by7Cn2kLoWtszjBAz3i2zUG9HrDOZz6RoPDj3bA1YQGMIOx9UW2wIdmBpMmHkomXzQFKJBn1OfJqnE/BNjIxc/MF512N05TRW3SfoL6U0Q3NF4zGRYiK7puAvC5Uveo3AVhipDzTVWTl/BH2Pw7djv0Jc6ervoSHw7IhsfQjfa0F9PJhQ5qUyxWp6V6yge/kRBv6tlcB1myhoKkx5CLsWpLdhOVRBWX7Nrx0afqb12Hp0Yio4mk75MDg0VtGtQEhT6h/vFo5KJkitsMLJI0RoytZmW5WeDY7u1fIzLB3QFe0GqtfXY9/0nDIDKdw==
In contrast, tsc has a simpler rule:
https://www.typescriptlang.org/play/?#code/PTAEEFQSwZ1BDANgd3gTzgJwKYwPaIBu2AJqAC54UAW2o2AdgK4C2oL2LARtpgHQAoIQAphASlABeAHygA3gNChC8TBCmgA5AHNEeLkk0BuRfWZsAYnioKlSyJNABGADSmlAIQ3gXoUwF8BfzFxEwFRCRl5UxU1By1dfUMTJUZWUA9VaLt1RwBZeHJqPkx4BhI8FnE3HK9HHwCgkLEwgTS2TIAvbNzQAqKSsoqqsRqM7zdAoA
Would it be better to switch to tsc's rule?
The text was updated successfully, but these errors were encountered: