Flow comments import export (#5675)

* Add failing test for `export type .. from ...; `

* Add support for flow comment : `export ... from '...'`
This commit is contained in:
James Lal
2017-05-20 06:10:39 -07:00
committed by Henry Zhu
parent 943fa8aa73
commit 6928695735
3 changed files with 9 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ export default function ({ types: t }) {
// support `export type a = {}` - #8 Error: You passed path.replaceWith() a falsy node
"ExportNamedDeclaration|Flow"(path) {
const { node, parent } = path;
if (t.isExportNamedDeclaration(node) && !t.isFlow(node.declaration)) {
if (t.isExportNamedDeclaration(node) && node.exportKind !== "type" && !t.isFlow(node.declaration)) {
return;
}
wrapInFlowComment(path, parent);

View File

@@ -0,0 +1,4 @@
import lib from 'library';
export { foo } from 'foo';
export type { B, C } from './types';

View File

@@ -0,0 +1,4 @@
import lib from 'library';
export { foo } from 'foo';
/*:: export type { B, C } from './types';*/