Small fix for parsing type parameter declarations

This commit is contained in:
Gabe Levi
2016-07-29 12:45:20 -04:00
parent 4811d617ce
commit 859ed04be9
3 changed files with 123 additions and 12 deletions

View File

@@ -19,3 +19,4 @@ interface A<T = string> {}
interface A<T: ?string = string> {}
interface A<S, T: ?string = string> {}
interface A<S = number, T: ?string = string> {}
type A<T = void> = T

View File

@@ -1,29 +1,29 @@
{
"type": "File",
"start": 0,
"end": 743,
"end": 764,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 21,
"column": 47
"line": 22,
"column": 20
}
},
"program": {
"type": "Program",
"start": 0,
"end": 743,
"end": 764,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 21,
"column": 47
"line": 22,
"column": 20
}
},
"sourceType": "module",
@@ -3122,6 +3122,117 @@
"properties": [],
"indexers": []
}
},
{
"type": "TypeAlias",
"start": 744,
"end": 764,
"loc": {
"start": {
"line": 22,
"column": 0
},
"end": {
"line": 22,
"column": 20
}
},
"id": {
"type": "Identifier",
"start": 749,
"end": 750,
"loc": {
"start": {
"line": 22,
"column": 5
},
"end": {
"line": 22,
"column": 6
}
},
"name": "A"
},
"typeParameters": {
"type": "TypeParameterDeclaration",
"start": 750,
"end": 760,
"loc": {
"start": {
"line": 22,
"column": 6
},
"end": {
"line": 22,
"column": 16
}
},
"params": [
{
"type": "TypeParameter",
"start": 751,
"end": 759,
"loc": {
"start": {
"line": 22,
"column": 7
},
"end": {
"line": 22,
"column": 15
}
},
"name": "T",
"default": {
"type": "VoidTypeAnnotation",
"start": 755,
"end": 759,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 15
}
}
}
}
]
},
"right": {
"type": "GenericTypeAnnotation",
"start": 763,
"end": 764,
"loc": {
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 20
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 763,
"end": 764,
"loc": {
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 20
}
},
"name": "T"
}
}
}
],
"directives": []