Fix regression with generic type and jsx (#702)

This commit is contained in:
Brian Ng
2017-08-28 15:51:37 -05:00
committed by Henry Zhu
parent 19bc694e7d
commit 2f76fc88be
3 changed files with 333 additions and 2 deletions

View File

@@ -1132,8 +1132,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.state.inType = true;
const type = this.flowParseUnionType();
this.state.inType = oldInType;
// noAnonFunctionType is true when parsing an arrow function
this.state.exprAllowed = this.state.noAnonFunctionType;
// Ensure that a brace after a function generic type annotation is a
// statement, except in arrow functions (noAnonFunctionType)
this.state.exprAllowed =
this.state.exprAllowed || this.state.noAnonFunctionType;
return type;
}