add support for export types
This commit is contained in:
@@ -669,6 +669,39 @@ export default function (instance) {
|
||||
};
|
||||
});
|
||||
|
||||
instance.extend("parseExport", function (inner) {
|
||||
return function (node) {
|
||||
node = inner.call(this, node);
|
||||
if (node.type === "ExportNamedDeclaration") {
|
||||
node.exportKind = node.exportKind || "value";
|
||||
}
|
||||
return node;
|
||||
};
|
||||
});
|
||||
|
||||
instance.extend("parseExportDeclaration", function (inner) {
|
||||
return function (node) {
|
||||
if (this.isContextual("type")) {
|
||||
node.exportKind = "type";
|
||||
|
||||
var declarationNode = this.startNode();
|
||||
this.next();
|
||||
|
||||
if (this.match(tt.braceL)) {
|
||||
// export type { foo, bar };
|
||||
node.specifiers = this.parseExportSpecifiers();
|
||||
this.parseExportFrom(node);
|
||||
return null;
|
||||
} else {
|
||||
// export type Foo = Bar;
|
||||
return this.flowParseTypeAlias(declarationNode);
|
||||
}
|
||||
} else {
|
||||
return inner.call(this, node);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
instance.extend("parseClassId", function (inner) {
|
||||
return function (node, isStatement) {
|
||||
inner.call(this, node, isStatement);
|
||||
|
||||
Reference in New Issue
Block a user