-
-
Notifications
You must be signed in to change notification settings - Fork 147
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] migrate our decorators to latest JS decorator spec #1180
Comments
Unless this proposal gets to stage 4, I think we should stay far away from it. I don't know how many hops we have to get through along the ride for a stage 2 proposal, especially this decorator one. |
I agree this is very important @3cp but I agree with @bigopon that right now given how turbulent the decorator's specification has been and the fact they've been trying to get decorators to stage 3 for three years now, we should stick with legacy. As we can see in this linked section in the README, they are recommending that everyone sticks with the legacy decorators for the time being. |
The state of decorator is so bad, if they can put decorator into ES spec, a lot of frameworks can use plain ESM code without transpiling. |
it's a massive move, we probably want to delay it until the last moment. If we were to do it now, any small changes from now would cause a lot of headache. |
For reference, decorators are implemented in TypeScript 5.0. |
馃挰 RFC
馃敠 Context
Our decorators are currently in outdated legacy decorator API format.
The result is we still need legacy mode when transpiling the code.
In Babel, it's
[ "@babel/plugin-proposal-decorators", { "legacy": true } ]
.In TypeScript, it's just
"experimentalDecorators": true
. TypeScript understands our decorators are in legacy mode because it knows the type definition of those decorators, so it smartly transpiling the code accordingly.We probably need to switch our decorators to the APIs of latest spec. https://github.com/tc39/proposal-decorators
Then we can drop
"legacy": true
in babel config. The babel config will become[ "@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true } ]
(For usability, we need that decoratorsBeforeExport to deviate from current spec, TypeScript silently supports that).馃捇 Examples
The text was updated successfully, but these errors were encountered: