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
Flow: losing info about explicitly inexact objects #10040
Comments
Hey @mrtnzlml! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Looks like generator needs support for printing the trailing ellipsis: https://github.com/babel/babel/blob/master/packages/babel-generator/src/generators/flow.js#L388 Want to take a stab @mrtnzlml? |
I am afraid I do not have enough Babel knowledge for this. I could check it later but it would be helpful if someone else did. :) BTW, real-world (similar) example: kiwicom/babel-preset-kiwicom@f592fb7 |
If anyone wants to open a PR, this is the file which handles the printing of flow-related nodes: https://github.com/babel/babel/blob/master/packages/babel-generator/src/generators/flow.js. As you can see in the babel/packages/babel-types/src/definitions/flow.js Lines 259 to 285 in 8d492b1
In the printer for that node, we are only checking for the babel/packages/babel-generator/src/generators/flow.js Lines 388 to 427 in 8d492b1
If you don't know how to clone Babel, follow these steps: (you need to have
|
I was actually looking into it now and it looks doable. Especially with your guidance, thanks! I will take it and fix it. |
Alright, here is my attempt: #10041 Please, have a look and let me know what to improve. |
Bug Report
Current Behavior
Babel is currently losing info about explicitly inexact objects when using Flow parser plugin. It should return the code as is. Thanks for checking it! :)
Input Code
This is not possible to reproduce in REPL. Input code:
Package.json:
Command:
Output:
As you can see, information about the inexact object (
...
) is lost.Expected behavior/code
It should return the code as is:
Babel Configuration (.babelrc)
Additional context/Screenshots
https://medium.com/flow-type/on-the-roadmap-exact-objects-by-default-16b72933c5cf
The text was updated successfully, but these errors were encountered: