TypeScript: Support type arguments on JSX opening and self-closing tags (#7799)

This commit is contained in:
Andy
2018-07-10 15:19:42 -07:00
committed by Brian Ng
parent 19a1705293
commit 301db1b921
17 changed files with 356 additions and 16 deletions

View File

@@ -0,0 +1,2 @@
<C<number>></C>;
<C<number>/>;

View File

@@ -0,0 +1,3 @@
{
"plugins": ["jsx", "typescript"]
}

View File

@@ -0,0 +1,259 @@
{
"type": "File",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 13
}
},
"program": {
"type": "Program",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 13
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"expression": {
"type": "JSXElement",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"openingElement": {
"type": "JSXOpeningElement",
"start": 0,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 11
}
},
"name": {
"type": "JSXIdentifier",
"start": 1,
"end": 2,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 2
}
},
"name": "C"
},
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"start": 2,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 10
}
},
"params": [
{
"type": "TSNumberKeyword",
"start": 3,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 9
}
}
}
]
},
"attributes": [],
"selfClosing": false
},
"closingElement": {
"type": "JSXClosingElement",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
}
},
"name": {
"type": "JSXIdentifier",
"start": 13,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
}
},
"name": "C"
}
},
"children": []
}
},
{
"type": "ExpressionStatement",
"start": 17,
"end": 30,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 13
}
},
"expression": {
"type": "JSXElement",
"start": 17,
"end": 29,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 12
}
},
"openingElement": {
"type": "JSXOpeningElement",
"start": 17,
"end": 29,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 12
}
},
"name": {
"type": "JSXIdentifier",
"start": 18,
"end": 19,
"loc": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 2,
"column": 2
}
},
"name": "C"
},
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"start": 19,
"end": 27,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 10
}
},
"params": [
{
"type": "TSNumberKeyword",
"start": 20,
"end": 26,
"loc": {
"start": {
"line": 2,
"column": 3
},
"end": {
"line": 2,
"column": 9
}
}
}
]
},
"attributes": [],
"selfClosing": true
},
"closingElement": null,
"children": []
}
}
],
"directives": []
}
}