remove grouped type arrow restriction as it seems flow no longer has it - fixes #44

This commit is contained in:
Sebastian McKenzie
2016-06-22 13:43:32 +01:00
parent f63802c716
commit 3524ad510f
3 changed files with 261 additions and 14 deletions

View File

@@ -517,20 +517,6 @@ pp.flowParsePrimaryType = function () {
if (isGroupedType) {
type = this.flowParseType();
this.expect(tt.parenR);
// If we see a => next then someone was probably confused about
// function types, so we can provide a better error message
if (this.eat(tt.arrow)) {
this.raise(node,
"Unexpected token =>. It looks like " +
"you are trying to write a function type, but you ended up " +
"writing a grouped type followed by an =>, which is a syntax " +
"error. Remember, function type parameters are named so function " +
"types look like (name1: type1, name2: type2) => returnType. You " +
"probably wrote (type1) => returnType"
);
}
return type;
}