-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Exporting decorated class error #4585
Comments
This might be an issue for Babylon instead |
Is there a reason why you aren't using the transform? You can use https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy to transform decorators and https://babeljs.io/docs/plugins/transform-flow-strip-types/ to remove flow types |
This should be a pretty self-contained code generator fix. We'll need the export declaration step to test what kind of declaration it has to potentially render decorators, and the opposite logic to skip them when rendering the class declaration itself. |
@hzoo it goes alongside #4388 that I reported. I have a Yeoman generator that I have parse JS files, and then strip flow types, but leave the remainder of the code mostly unchanged. |
Can you point me to where this might be fixed in the code? |
Yeah Example with decorator: babel/packages/babel-generator/src/generators/expressions.js Lines 79 to 83 in 39c9216
Probably need to fix something in babel/modules.js like at babel/packages/babel-generator/src/generators/modules.js Lines 70 to 118 in 39c9216
Can use http://astexplorer.net/#/pzoRIHiZyd to view the AST |
Fixed by #5020. |
This isn't allowed in Stage 2 decorators anymore so closing https://github.com/babel/babylon/pull/587/files#diff-cd89c8d2f00940bd0d50120e23c326edR1
|
Input Code
Babel Configuration (.bablerc, package.json, cli command)
Expected Behavior
Current Behavior
Possible Solution
What I'm currently doing to circumvent this:
¯\_(ツ)_/¯
Context
I've got a project where I'm trying to parse ES6 code with Flow types, and just take the types out. This minimal case reproduces the same issue, though.
Your Environment
The text was updated successfully, but these errors were encountered: