Skip to content

Commit

Permalink
fix: register inserted importDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jul 5, 2019
1 parent bff79e1 commit c092c1e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 0 deletions.
Expand Up @@ -35,6 +35,11 @@ export default declare(api => {

path.replaceWithMultiple(nodes);
},
ImportDefaultSpecifier(path) {
if (!path.scope.hasOwnBinding(path.node.local.name)) {
path.scope.registerDeclaration(path.parentPath);
}
},
},
};
});
@@ -0,0 +1 @@
export foo from "bar";
@@ -0,0 +1,3 @@
{
"plugins": ["proposal-export-default-from", "transform-typescript"]
}
@@ -0,0 +1,2 @@
import _foo from "bar";
export { _foo as foo };
Expand Up @@ -45,6 +45,11 @@ export default declare(api => {

path.replaceWithMultiple(nodes);
},
ImportNamespaceSpecifier(path) {
if (!path.scope.hasOwnBinding(path.node.local.name)) {
path.scope.registerDeclaration(path.parentPath);
}
},
},
};
});
@@ -0,0 +1 @@
export * as foo from "bar";
@@ -0,0 +1,3 @@
{
"plugins": ["proposal-export-namespace-from", "transform-typescript"]
}
@@ -0,0 +1,2 @@
import * as _foo from "bar";
export { _foo as foo };

0 comments on commit c092c1e

Please sign in to comment.