Fix #321 by allowing question marks in type params (#338)

* Fix #321 by allowing question marks in type params

* Require commas between params
This commit is contained in:
Daniel Tschinder
2017-02-10 15:03:15 +01:00
committed by GitHub
parent bc771bd0f9
commit 407c97c9c2
5 changed files with 625 additions and 1 deletions

View File

@@ -569,7 +569,7 @@ pp.reinterpretTypeAsFunctionTypeParam = function (type) {
pp.flowParseFunctionTypeParams = function (params = []) {
const ret = { params, rest: null };
while (this.match(tt.name)) {
while (!this.match(tt.parenR) && !this.match(tt.ellipsis)) {
ret.params.push(this.flowParseFunctionTypeParam());
if (!this.match(tt.parenR)) {
this.expect(tt.comma);