Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TS] Parse calls with type args in optional chains (#10631)
* [TS] Parse calls with type args in optional chains * Test output
- Loading branch information
1 parent
abce0ef
commit d023e10
Showing
6 changed files
with
204 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
example.inner?.greet<string>() |
4 changes: 4 additions & 0 deletions
4
packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"sourceType": "module", | ||
"plugins": ["typescript", "optionalChaining"] | ||
} |
182 changes: 182 additions & 0 deletions
182
packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 30 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 30 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 30 | ||
} | ||
}, | ||
"expression": { | ||
"type": "OptionalCallExpression", | ||
"start": 0, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 30 | ||
} | ||
}, | ||
"callee": { | ||
"type": "OptionalMemberExpression", | ||
"start": 0, | ||
"end": 20, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 20 | ||
} | ||
}, | ||
"object": { | ||
"type": "MemberExpression", | ||
"start": 0, | ||
"end": 13, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 13 | ||
} | ||
}, | ||
"object": { | ||
"type": "Identifier", | ||
"start": 0, | ||
"end": 7, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 7 | ||
}, | ||
"identifierName": "example" | ||
}, | ||
"name": "example" | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 8, | ||
"end": 13, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 13 | ||
}, | ||
"identifierName": "inner" | ||
}, | ||
"name": "inner" | ||
}, | ||
"computed": false | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 15, | ||
"end": 20, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 15 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 20 | ||
}, | ||
"identifierName": "greet" | ||
}, | ||
"name": "greet" | ||
}, | ||
"computed": false, | ||
"optional": true | ||
}, | ||
"arguments": [], | ||
"typeParameters": { | ||
"type": "TSTypeParameterInstantiation", | ||
"start": 20, | ||
"end": 28, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 20 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 28 | ||
} | ||
}, | ||
"params": [ | ||
{ | ||
"type": "TSStringKeyword", | ||
"start": 21, | ||
"end": 27, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 21 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 27 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |