swc/crates/swc_ecma_parser/tests/tsc/tsxAttributeResolution14.json
2022-03-22 07:54:08 +00:00

925 lines
27 KiB
JSON

{
"type": "Script",
"span": {
"start": 57,
"end": 683,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 57,
"end": 208,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 75,
"ctxt": 0
},
"value": "JSX",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 76,
"end": 208,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 79,
"end": 100,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 89,
"end": 96,
"ctxt": 0
},
"value": "Element",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"body": []
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 102,
"end": 152,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 112,
"end": 129,
"ctxt": 0
},
"value": "IntrinsicElements",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 130,
"end": 152,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 140,
"end": 149,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 140,
"end": 143,
"ctxt": 0
},
"value": "div",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 143,
"end": 148,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 145,
"end": 148,
"ctxt": 0
},
"kind": "any"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 157,
"end": 206,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 167,
"end": 192,
"ctxt": 0
},
"value": "ElementAttributesProperty",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 193,
"end": 206,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 195,
"end": 204,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 195,
"end": 199,
"ctxt": 0
},
"value": "prop",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 199,
"end": 204,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 201,
"end": 204,
"ctxt": 0
},
"kind": "any"
}
},
"typeParams": null
}
]
}
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 233,
"end": 314,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 243,
"end": 249,
"ctxt": 0
},
"value": "IProps",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 250,
"end": 314,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 254,
"end": 274,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 254,
"end": 265,
"ctxt": 0
},
"value": "primaryText",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 265,
"end": 273,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 267,
"end": 273,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 278,
"end": 294,
"ctxt": 0
},
"value": "propName",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 286,
"end": 294,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 288,
"end": 294,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 295,
"end": 312,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 297,
"end": 312,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 297,
"end": 303,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 306,
"end": 312,
"ctxt": 0
},
"kind": "number"
}
]
}
},
"readonly": false,
"static": false,
"span": {
"start": 277,
"end": 312,
"ctxt": 0
}
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 325,
"end": 344,
"ctxt": 0
},
"value": "VerticalNavMenuItem",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 345,
"end": 357,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 345,
"end": 357,
"ctxt": 0
},
"value": "prop",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 349,
"end": 357,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 351,
"end": 357,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 351,
"end": 357,
"ctxt": 0
},
"value": "IProps",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 316,
"end": 400,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 359,
"end": 400,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 363,
"end": 398,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 370,
"end": 398,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 371,
"end": 374,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 370,
"end": 375,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 375,
"end": 392,
"ctxt": 0
},
"value": "props.primaryText",
"raw": "props.primaryText"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 392,
"end": 398,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 394,
"end": 397,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 411,
"end": 422,
"ctxt": 0
},
"value": "VerticalNav",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 402,
"end": 683,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 425,
"end": 683,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 429,
"end": 681,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 436,
"end": 681,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 442,
"end": 677,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 443,
"end": 446,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 442,
"end": 447,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 447,
"end": 454,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXElement",
"span": {
"start": 454,
"end": 493,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 455,
"end": 474,
"ctxt": 0
},
"value": "VerticalNavMenuItem",
"optional": false
},
"span": {
"start": 454,
"end": 493,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 475,
"end": 490,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 475,
"end": 486,
"ctxt": 0
},
"value": "primaryText",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 487,
"end": 490,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 488,
"end": 489,
"ctxt": 0
},
"value": 2.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 493,
"end": 510,
"ctxt": 0
},
"value": " // error\n\n ",
"raw": " // error\n\n "
},
{
"type": "JSXElement",
"span": {
"start": 510,
"end": 574,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 511,
"end": 530,
"ctxt": 0
},
"value": "VerticalNavMenuItem",
"optional": false
},
"span": {
"start": 510,
"end": 574,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 531,
"end": 549,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 531,
"end": 545,
"ctxt": 0
},
"value": "justRandomProp",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 546,
"end": 549,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 547,
"end": 548,
"ctxt": 0
},
"value": 2.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 550,
"end": 571,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 550,
"end": 561,
"ctxt": 0
},
"value": "primaryText",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 562,
"end": 571,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 563,
"end": 570,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 574,
"end": 588,
"ctxt": 0
},
"value": " // ok\n\n ",
"raw": " // ok\n\n "
},
{
"type": "JSXElement",
"span": {
"start": 588,
"end": 656,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 589,
"end": 608,
"ctxt": 0
},
"value": "VerticalNavMenuItem",
"optional": false
},
"span": {
"start": 588,
"end": 656,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 609,
"end": 631,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 609,
"end": 624,
"ctxt": 0
},
"value": "justRandomProp1",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 625,
"end": 631,
"ctxt": 0
},
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 626,
"end": 630,
"ctxt": 0
},
"value": true
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 632,
"end": 653,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 632,
"end": 643,
"ctxt": 0
},
"value": "primaryText",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 644,
"end": 653,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 645,
"end": 652,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 656,
"end": 671,
"ctxt": 0
},
"value": " // error\n\n ",
"raw": " // error\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 671,
"end": 677,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 673,
"end": 676,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}