Skip to content

Commit

Permalink
fix: export should not be erased when mixed with `proposal-export-def…
Browse files Browse the repository at this point in the history
…ault-from`
  • Loading branch information
JLHwung committed Jul 5, 2019
1 parent bff79e1 commit eac1b1c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/babel-plugin-transform-typescript/src/index.js
Expand Up @@ -101,7 +101,7 @@ export default declare(
!path.node.source &&
path.node.specifiers.length > 0 &&
!path.node.specifiers.find(exportSpecifier =>
path.scope.hasOwnBinding(exportSpecifier.local.name),
path.scope.hasBinding(exportSpecifier.local.name),
)
) {
path.remove();
Expand All @@ -112,7 +112,7 @@ export default declare(
// remove type exports
if (
!path.parent.source &&
!path.scope.hasOwnBinding(path.node.local.name)
!path.scope.hasBinding(path.node.local.name)
) {
path.remove();
}
Expand All @@ -122,7 +122,7 @@ export default declare(
// remove whole declaration if it's exporting a TS type
if (
t.isIdentifier(path.node.declaration) &&
!path.scope.hasOwnBinding(path.node.declaration.name)
!path.scope.hasBinding(path.node.declaration.name)
) {
path.remove();
}
Expand Down
@@ -0,0 +1 @@
export foo from "./foo";
@@ -0,0 +1,3 @@
{
"plugins": ["proposal-export-default-from", ["transform-typescript", { "allowNamespaces": true }]]
}
@@ -0,0 +1,2 @@
import _foo from "./foo";
export { _foo as foo };

0 comments on commit eac1b1c

Please sign in to comment.