Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility between typescript and jsx plugins in interface dec…
…larations (#9058)
- Loading branch information
Showing
4 changed files
with
286 additions
and
1 deletion.
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
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/typescript/regression/issue-7742/input.js
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,3 @@ | ||
interface Foo<G> { | ||
<T>(bar: G): T; | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/babel-parser/test/fixtures/typescript/regression/issue-7742/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", "jsx"] | ||
} |
278 changes: 278 additions & 0 deletions
278
packages/babel-parser/test/fixtures/typescript/regression/issue-7742/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,278 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 40, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 40, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSInterfaceDeclaration", | ||
"start": 0, | ||
"end": 40, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 10, | ||
"end": 13, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 13 | ||
}, | ||
"identifierName": "Foo" | ||
}, | ||
"name": "Foo" | ||
}, | ||
"typeParameters": { | ||
"type": "TSTypeParameterDeclaration", | ||
"start": 13, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 13 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 16 | ||
} | ||
}, | ||
"params": [ | ||
{ | ||
"type": "TSTypeParameter", | ||
"start": 14, | ||
"end": 15, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
} | ||
}, | ||
"name": "G" | ||
} | ||
] | ||
}, | ||
"body": { | ||
"type": "TSInterfaceBody", | ||
"start": 17, | ||
"end": 40, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1 | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "TSCallSignatureDeclaration", | ||
"start": 23, | ||
"end": 38, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 19 | ||
} | ||
}, | ||
"typeParameters": { | ||
"type": "TSTypeParameterDeclaration", | ||
"start": 23, | ||
"end": 26, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 7 | ||
} | ||
}, | ||
"params": [ | ||
{ | ||
"type": "TSTypeParameter", | ||
"start": 24, | ||
"end": 25, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 6 | ||
} | ||
}, | ||
"name": "T" | ||
} | ||
] | ||
}, | ||
"parameters": [ | ||
{ | ||
"type": "Identifier", | ||
"start": 27, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14 | ||
}, | ||
"identifierName": "bar" | ||
}, | ||
"name": "bar", | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start": 30, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 11 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14 | ||
} | ||
}, | ||
"typeAnnotation": { | ||
"type": "TSTypeReference", | ||
"start": 32, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 13 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14 | ||
} | ||
}, | ||
"typeName": { | ||
"type": "Identifier", | ||
"start": 32, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 13 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14 | ||
}, | ||
"identifierName": "G" | ||
}, | ||
"name": "G" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start": 34, | ||
"end": 37, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 15 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 18 | ||
} | ||
}, | ||
"typeAnnotation": { | ||
"type": "TSTypeReference", | ||
"start": 36, | ||
"end": 37, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 18 | ||
} | ||
}, | ||
"typeName": { | ||
"type": "Identifier", | ||
"start": 36, | ||
"end": 37, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 18 | ||
}, | ||
"identifierName": "T" | ||
}, | ||
"name": "T" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |