Fix range on TypeScript index signature parameters (#9335)

This commit is contained in:
Brian Ng 2019-01-15 06:52:33 -06:00 committed by GitHub
parent e8038863c3
commit 34c9890f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 18 deletions

View File

@ -398,8 +398,9 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.expect(tt.bracketL);
const id = this.parseIdentifier();
this.expect(tt.colon);
id.typeAnnotation = this.tsParseTypeAnnotation(/* eatColon */ false);
id.typeAnnotation = this.tsParseTypeAnnotation();
this.finishNode(id, "Identifier"); // set end position to end of type
this.expect(tt.bracketR);
node.parameters = [id];

View File

@ -94,7 +94,7 @@
{
"type": "Identifier",
"start": 23,
"end": 24,
"end": 32,
"loc": {
"start": {
"line": 2,
@ -102,19 +102,19 @@
},
"end": {
"line": 2,
"column": 6
"column": 14
},
"identifierName": "x"
},
"name": "x",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 26,
"start": 24,
"end": 32,
"loc": {
"start": {
"line": 2,
"column": 8
"column": 6
},
"end": {
"line": 2,

View File

@ -94,7 +94,7 @@
{
"type": "Identifier",
"start": 15,
"end": 16,
"end": 24,
"loc": {
"start": {
"line": 2,
@ -102,19 +102,19 @@
},
"end": {
"line": 2,
"column": 6
"column": 14
},
"identifierName": "x"
},
"name": "x",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 18,
"start": 16,
"end": 24,
"loc": {
"start": {
"line": 2,
"column": 8
"column": 6
},
"end": {
"line": 2,
@ -189,7 +189,7 @@
{
"type": "Identifier",
"start": 46,
"end": 47,
"end": 55,
"loc": {
"start": {
"line": 3,
@ -197,19 +197,19 @@
},
"end": {
"line": 3,
"column": 15
"column": 23
},
"identifierName": "x"
},
"name": "x",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 49,
"start": 47,
"end": 55,
"loc": {
"start": {
"line": 3,
"column": 17
"column": 15
},
"end": {
"line": 3,

View File

@ -93,7 +93,7 @@
{
"type": "Identifier",
"start": 19,
"end": 20,
"end": 28,
"loc": {
"start": {
"line": 2,
@ -101,19 +101,19 @@
},
"end": {
"line": 2,
"column": 6
"column": 14
},
"identifierName": "s"
},
"name": "s",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 22,
"start": 20,
"end": 28,
"loc": {
"start": {
"line": 2,
"column": 8
"column": 6
},
"end": {
"line": 2,