Fix #437: only prohibit 'export type from "module" ' when flow is enabled (#438)

* Only prohibit 'export type' when flow is enabled

* Fix lint
This commit is contained in:
Kevin Gibbons
2017-05-19 01:05:44 -07:00
committed by Daniel Tschinder
parent dcef4012a0
commit 6c4acecf00
6 changed files with 122 additions and 3 deletions

View File

@@ -1061,6 +1061,17 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
|| super.shouldParseExportDeclaration();
}
isExportDefaultSpecifier(): boolean {
if (
this.match(tt.name) &&
(this.state.value === "type" || this.state.value === "interface")
) {
return false;
}
return super.isExportDefaultSpecifier();
}
parseConditional(expr: N.Expression, noIn: ?boolean, startPos: number, startLoc: Position, refNeedsArrowPos?: Pos): N.Expression {
// only do the expensive clone if there is a question mark
// and if we come from inside parens