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
[legacy decorators] Allow decorating generator methods #9912
[legacy decorators] Allow decorating generator methods #9912
Conversation
The old proposal used LeftHandSideExpression (instead of AssignmentExpression) to satisfy this usecase: wycats/javascript-decorators@e240cbc
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10739/ |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10738/ |
@@ -0,0 +1,4 @@ | |||
class Foo { | |||
@deco | |||
*generatorMethod() {} |
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.
YAAAAAS. This'll make ember-concurrency beautiful!
Just to understand this correctly: it wasn't allowed in legacy decorators, but it was in the old "new" implementation, but now in the "newest" it is disallowed? |
It was allowed in a very early version of legacy decorators. It is disallowed in the "last" version of legacy decorators, in the "old new (a few months ago)" implementation and in the new not-yet-implemented version. Other than that, it is also disallowed by Flow and TypeScript. |
Is this going to be in the next release? It's a pretty big issue requiring ugly workarounds if needing decorators for generators. A lot of people are waiting on this. |
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.
nice fix!
maybe also document this on the docs page?
The old proposal used LeftHandSideExpression (instead of
AssignmentExpression) to satisfy this usecase:
wycats/javascript-decorators@e240cbc
This PR will break the code of people doing things like
I don't think that it is a problem because:
@(foo && bar)
)