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
fix(typescript): erase type exports #9944
fix(typescript): erase type exports #9944
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10772/ |
path.node.specifiers.length > 0 && | ||
!path.node.specifiers.find( | ||
exportSpecifier => | ||
exportableTSNames.indexOf(exportSpecifier.local.name) === -1, |
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.
exportableTSNames
should probably be anew Set()
?- I don't remember if
@babel/traverse
's scope tracking supports TypeScript. If it does, we could checkpath.sope.getBinding(exportSpecifier.local.name)
instead of usingexportableTSNames
.
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.
scope.getBinding
doesn't seem to work for TS type declarations
Could you also add a test for an interface exported before its declaration? It seems to be working on the repl (repl with ts support), but it's better to test it. |
Thanks! |
@Sergiioo Not sure when the next version of Babel with this inside it will be released but this will be worth an upgrade. |
This also fixes enum not adding the respective declaration to the scope during the typescript visitation. Rewrites: 2080042 babel#9944 a6392bd babel#10019
some context #9766 (comment)
cc @nicolo-ribaudo