Skip to content
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

Merged
merged 3 commits into from May 17, 2019

Conversation

airato
Copy link
Contributor

@airato airato commented May 5, 2019

some context #9766 (comment)
cc @nicolo-ribaudo

Q                       A
Fixed Issues? Fixes #9763, Fixes #9480, Fixes #6065, Fixes #7640
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@babel-bot
Copy link
Collaborator

babel-bot commented May 5, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10772/

@nicolo-ribaudo nicolo-ribaudo self-requested a review May 5, 2019 21:22
path.node.specifiers.length > 0 &&
!path.node.specifiers.find(
exportSpecifier =>
exportableTSNames.indexOf(exportSpecifier.local.name) === -1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. exportableTSNames should probably be a new Set()?
  2. I don't remember if @babel/traverse's scope tracking supports TypeScript. If it does, we could check path.sope.getBinding(exportSpecifier.local.name) instead of using exportableTSNames.

Copy link
Contributor Author

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

@nicolo-ribaudo nicolo-ribaudo added area: typescript PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels May 6, 2019
@nicolo-ribaudo
Copy link
Member

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.

@nicolo-ribaudo nicolo-ribaudo merged commit 2080042 into babel:master May 17, 2019
@nicolo-ribaudo
Copy link
Member

Thanks!

@sebinsua
Copy link

@Sergiioo Not sure when the next version of Babel with this inside it will be released but this will be worth an upgrade.

Wolvereness added a commit to VelocityMSC/babel that referenced this pull request May 28, 2019
Wolvereness added a commit to VelocityMSC/babel that referenced this pull request May 28, 2019
Wolvereness added a commit to VelocityMSC/babel that referenced this pull request May 28, 2019
This also fixes enum not adding the respective declaration to the scope
during the typescript visitation.

Rewrites:

2080042 babel#9944

a6392bd babel#10019
nicolo-ribaudo pushed a commit that referenced this pull request May 29, 2019
This also fixes enum not adding the respective declaration to the scope
during the typescript visitation.

Rewrites:

2080042 #9944

a6392bd #10019
@JLHwung JLHwung mentioned this pull request Jul 15, 2019
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
6 participants