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

978 lines
29 KiB
JSON

{
"type": "Module",
"span": {
"start": 115,
"end": 666,
"ctxt": 0
},
"body": [
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 115,
"end": 147,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 122,
"end": 127,
"ctxt": 0
},
"value": "React",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 130,
"end": 146,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 138,
"end": 145,
"ctxt": 0
},
"value": "react",
"raw": "'react'"
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 149,
"end": 225,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 169,
"ctxt": 0
},
"value": "ButtonProp",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 170,
"end": 225,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 176,
"end": 186,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 177,
"end": 185,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 179,
"end": 185,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 191,
"end": 201,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 192,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 194,
"end": 200,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 206,
"end": 223,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 206,
"end": 214,
"ctxt": 0
},
"value": "children",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 214,
"end": 222,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 216,
"end": 222,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 216,
"end": 222,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 233,
"end": 239,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"declare": false,
"span": {
"start": 227,
"end": 505,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 287,
"end": 503,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 287,
"end": 293,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 287,
"end": 503,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 296,
"end": 503,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 300,
"end": 323,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 304,
"end": 322,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 304,
"end": 313,
"ctxt": 0
},
"value": "condition",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 313,
"end": 322,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 315,
"end": 322,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 326,
"end": 497,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 330,
"end": 339,
"ctxt": 0
},
"value": "condition",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 341,
"end": 394,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 352,
"end": 390,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 359,
"end": 390,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 360,
"end": 371,
"ctxt": 0
},
"value": "InnerButton",
"optional": false
},
"span": {
"start": 359,
"end": 390,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 373,
"end": 376,
"ctxt": 0
},
"arguments": {
"type": "MemberExpression",
"span": {
"start": 376,
"end": 386,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 376,
"end": 380,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 381,
"end": 386,
"ctxt": 0
},
"value": "props",
"optional": false
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 402,
"end": 497,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 407,
"end": 493,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 414,
"end": 492,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 415,
"end": 491,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 416,
"end": 427,
"ctxt": 0
},
"value": "InnerButton",
"optional": false
},
"span": {
"start": 415,
"end": 445,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 429,
"end": 432,
"ctxt": 0
},
"arguments": {
"type": "MemberExpression",
"span": {
"start": 432,
"end": 442,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 432,
"end": 436,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 437,
"end": 442,
"ctxt": 0
},
"value": "props",
"optional": false
}
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 445,
"end": 450,
"ctxt": 0
},
"value": "\n\n\t\t\t\t",
"raw": "\n\n\t\t\t\t"
},
{
"type": "JSXElement",
"span": {
"start": 450,
"end": 472,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 451,
"end": 454,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 450,
"end": 455,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 455,
"end": 466,
"ctxt": 0
},
"value": "Hello World",
"raw": "Hello World"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 466,
"end": 472,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 468,
"end": 471,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
},
{
"type": "JSXText",
"span": {
"start": 472,
"end": 477,
"ctxt": 0
},
"value": "\n\n\t\t\t\t",
"raw": "\n\n\t\t\t\t"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 477,
"end": 491,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 479,
"end": 490,
"ctxt": 0
},
"value": "InnerButton",
"optional": false
}
}
}
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "MemberExpression",
"span": {
"start": 248,
"end": 263,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 248,
"end": 253,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 254,
"end": 263,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 263,
"end": 280,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 264,
"end": 274,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 264,
"end": 274,
"ctxt": 0
},
"value": "ButtonProp",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 276,
"end": 279,
"ctxt": 0
},
"kind": "any"
}
]
},
"implements": []
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 507,
"end": 547,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 517,
"end": 532,
"ctxt": 0
},
"value": "InnerButtonProp",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 533,
"end": 547,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 536,
"end": 545,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 536,
"end": 537,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 537,
"end": 545,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 539,
"end": 545,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 555,
"end": 566,
"ctxt": 0
},
"value": "InnerButton",
"optional": false
},
"declare": false,
"span": {
"start": 549,
"end": 666,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 616,
"end": 664,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 616,
"end": 622,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 616,
"end": 664,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 625,
"end": 664,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 629,
"end": 661,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 636,
"end": 660,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 637,
"end": 659,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 638,
"end": 644,
"ctxt": 0
},
"value": "button",
"optional": false
},
"span": {
"start": 637,
"end": 645,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 645,
"end": 650,
"ctxt": 0
},
"value": "Hello",
"raw": "Hello"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 650,
"end": 659,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 652,
"end": 658,
"ctxt": 0
},
"value": "button",
"optional": false
}
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "MemberExpression",
"span": {
"start": 575,
"end": 590,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 575,
"end": 580,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 581,
"end": 590,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 590,
"end": 612,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 591,
"end": 606,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 591,
"end": 606,
"ctxt": 0
},
"value": "InnerButtonProp",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 608,
"end": 611,
"ctxt": 0
},
"kind": "any"
}
]
},
"implements": []
}
],
"interpreter": null
}