💻
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
See this repo: https://github.com/evanw/decorator-tests
Configuration file name
No response
Configuration
No response
Current and expected behavior
I'm working on adding stage 3 decorators to esbuild. My first step was to write a lot of tests and run them through the Babel and TypeScript implementations. I'm sending you this issue because I figured you might be interested to learn about the behavior differences that I found. This is not a problem for me as I don't use Babel myself, so feel free to close this issue after reading it if you'd like. Here are the unexpected behaviors I found with Babel's implementation (see the repo for details):
Caveat: I'm just learning about this feature now, and I'm also not sure how up-to-date the specification is, so it could be that Babel's behavior for some of these is intentional. But if so, that behavior at least differs from TypeScript's implementation, which seems undesirable. FWIW I'm currently mostly planning to align esbuild's behavior to TypeScript since it seems like it matches the specification more closely, so it'd be good to know if Babel's behavior here is actually more correct (e.g. regarding access).
Environment
I can reproduce this by running Babel using https://babel.dev/repl.
Possible solution
No response
Additional context
No response
💻
How are you using Babel?
Programmatic API (
babel.transform,babel.parse)Input code
See this repo: https://github.com/evanw/decorator-tests
Configuration file name
No response
Configuration
No response
Current and expected behavior
I'm working on adding stage 3 decorators to esbuild. My first step was to write a lot of tests and run them through the Babel and TypeScript implementations. I'm sending you this issue because I figured you might be interested to learn about the behavior differences that I found. This is not a problem for me as I don't use Babel myself, so feel free to close this issue after reading it if you'd like. Here are the unexpected behaviors I found with Babel's implementation (see the repo for details):
accessexposes the underlying getter and setter instead of theGetandSetabstract operations. (fix: decorator bindsgetter/settertoctx.accessfor public fields #16201)addInitializermethod. (Allow addInitializer in field decorator context #16132)undefinedinstead of throwing aReferenceErrorif a class decorator is present. (Class binding is in TDZ during decorators initialization #16138)Caveat: I'm just learning about this feature now, and I'm also not sure how up-to-date the specification is, so it could be that Babel's behavior for some of these is intentional. But if so, that behavior at least differs from TypeScript's implementation, which seems undesirable. FWIW I'm currently mostly planning to align esbuild's behavior to TypeScript since it seems like it matches the specification more closely, so it'd be good to know if Babel's behavior here is actually more correct (e.g. regarding
access).Environment
I can reproduce this by running Babel using https://babel.dev/repl.
Possible solution
No response
Additional context
No response