Retain typescript export-from-source (#10167)

This commit is contained in:
Wesley Wolfe 2019-07-05 13:47:55 -05:00 committed by Nicolò Ribaudo
parent 106bb41d47
commit bff79e198a
5 changed files with 9 additions and 1 deletions

View File

@ -98,6 +98,7 @@ export default declare(
ExportNamedDeclaration(path) {
// remove export declaration if it's exporting only types
if (
!path.node.source &&
path.node.specifiers.length > 0 &&
!path.node.specifiers.find(exportSpecifier =>
path.scope.hasOwnBinding(exportSpecifier.local.name),
@ -109,7 +110,10 @@ export default declare(
ExportSpecifier(path) {
// remove type exports
if (!path.scope.hasOwnBinding(path.node.local.name)) {
if (
!path.parent.source &&
!path.scope.hasOwnBinding(path.node.local.name)
) {
path.remove();
}
},

View File

@ -0,0 +1 @@
export default "foo";

View File

@ -0,0 +1 @@
export default "foo";

View File

@ -0,0 +1 @@
export { bar } from './bar';

View File

@ -0,0 +1 @@
export { bar } from './bar';