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

1466 lines
39 KiB
JSON

{
"type": "Module",
"span": {
"start": 115,
"end": 729,
"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": 240,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 163,
"ctxt": 0
},
"value": "Prop",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 164,
"end": 240,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 170,
"end": 180,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 171,
"end": 179,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 173,
"end": 179,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 185,
"end": 195,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 186,
"end": 194,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 188,
"end": 194,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 200,
"end": 238,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 200,
"end": 208,
"ctxt": 0
},
"value": "children",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 208,
"end": 237,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 210,
"end": 237,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 210,
"end": 221,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 210,
"end": 213,
"ctxt": 0
},
"value": "JSX",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 214,
"end": 221,
"ctxt": 0
},
"value": "Element",
"optional": false
}
},
"typeParams": null
},
{
"type": "TsArrayType",
"span": {
"start": 224,
"end": 237,
"ctxt": 0
},
"elemType": {
"type": "TsTypeReference",
"span": {
"start": 224,
"end": 235,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 224,
"end": 227,
"ctxt": 0
},
"value": "JSX",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 228,
"end": 235,
"ctxt": 0
},
"value": "Element",
"optional": false
}
},
"typeParams": null
}
}
]
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 248,
"end": 254,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"declare": false,
"span": {
"start": 242,
"end": 351,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 295,
"end": 349,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 295,
"end": 301,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 295,
"end": 349,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 304,
"end": 349,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 314,
"end": 343,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 321,
"end": 343,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 322,
"end": 342,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 323,
"end": 326,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 322,
"end": 327,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 327,
"end": 336,
"ctxt": 0
},
"value": "My Button",
"raw": "My Button"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 336,
"end": 342,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 338,
"end": 341,
"ctxt": 0
},
"value": "div",
"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": 263,
"end": 278,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 263,
"end": 268,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 269,
"end": 278,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 278,
"end": 288,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 279,
"end": 282,
"ctxt": 0
},
"kind": "any"
},
{
"type": "TsKeywordType",
"span": {
"start": 284,
"end": 287,
"ctxt": 0
},
"kind": "any"
}
]
},
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 362,
"end": 375,
"ctxt": 0
},
"value": "AnotherButton",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 376,
"end": 382,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 376,
"end": 382,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 377,
"end": 382,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 379,
"end": 382,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 353,
"end": 428,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 384,
"end": 428,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 390,
"end": 426,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 397,
"end": 425,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 398,
"end": 400,
"ctxt": 0
},
"value": "h1",
"optional": false
},
"span": {
"start": 397,
"end": 401,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 401,
"end": 420,
"ctxt": 0
},
"value": "Just Another Button",
"raw": "Just Another Button"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 420,
"end": 425,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 422,
"end": 424,
"ctxt": 0
},
"value": "h1",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 439,
"end": 443,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 444,
"end": 451,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 444,
"end": 451,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 445,
"end": 451,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 447,
"end": 451,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 447,
"end": 451,
"ctxt": 0
},
"value": "Prop",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 430,
"end": 485,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 453,
"end": 485,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 459,
"end": 483,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 466,
"end": 482,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 467,
"end": 470,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 466,
"end": 471,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXExpressionContainer",
"span": {
"start": 471,
"end": 476,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 472,
"end": 475,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 472,
"end": 473,
"ctxt": 0
},
"value": "p",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 474,
"end": 475,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 476,
"end": 482,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 478,
"end": 481,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 517,
"end": 583,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 521,
"end": 582,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 521,
"end": 523,
"ctxt": 0
},
"value": "k1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 526,
"end": 582,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 527,
"end": 531,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 526,
"end": 546,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 532,
"end": 538,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 532,
"end": 533,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 534,
"end": 538,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 535,
"end": 537,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 539,
"end": 545,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 539,
"end": 540,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 541,
"end": 545,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXElement",
"span": {
"start": 546,
"end": 556,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 547,
"end": 553,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"span": {
"start": 546,
"end": 556,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 556,
"end": 558,
"ctxt": 0
},
"value": " ",
"raw": " "
},
{
"type": "JSXElement",
"span": {
"start": 558,
"end": 575,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 559,
"end": 572,
"ctxt": 0
},
"value": "AnotherButton",
"optional": false
},
"span": {
"start": 558,
"end": 575,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 575,
"end": 582,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 577,
"end": 581,
"ctxt": 0
},
"value": "Comp",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 584,
"end": 655,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 588,
"end": 654,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 588,
"end": 590,
"ctxt": 0
},
"value": "k2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 593,
"end": 654,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 594,
"end": 598,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 593,
"end": 613,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 599,
"end": 605,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 599,
"end": 600,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 601,
"end": 605,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 602,
"end": 604,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 606,
"end": 612,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 606,
"end": 607,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 608,
"end": 612,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXElement",
"span": {
"start": 613,
"end": 623,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 614,
"end": 620,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"span": {
"start": 613,
"end": 623,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 623,
"end": 628,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXElement",
"span": {
"start": 628,
"end": 645,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 629,
"end": 642,
"ctxt": 0
},
"value": "AnotherButton",
"optional": false
},
"span": {
"start": 628,
"end": 645,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 645,
"end": 647,
"ctxt": 0
},
"value": " ",
"raw": " "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 647,
"end": 654,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 649,
"end": 653,
"ctxt": 0
},
"value": "Comp",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 656,
"end": 729,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 660,
"end": 728,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 660,
"end": 662,
"ctxt": 0
},
"value": "k3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 665,
"end": 728,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 666,
"end": 670,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 665,
"end": 685,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 671,
"end": 677,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 671,
"end": 672,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 673,
"end": 677,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 674,
"end": 676,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 678,
"end": 684,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 678,
"end": 679,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 680,
"end": 684,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 685,
"end": 689,
"ctxt": 0
},
"value": " ",
"raw": " "
},
{
"type": "JSXElement",
"span": {
"start": 689,
"end": 699,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 690,
"end": 696,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"span": {
"start": 689,
"end": 699,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 699,
"end": 704,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXElement",
"span": {
"start": 704,
"end": 721,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 705,
"end": 718,
"ctxt": 0
},
"value": "AnotherButton",
"optional": false
},
"span": {
"start": 704,
"end": 721,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 721,
"end": 728,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 723,
"end": 727,
"ctxt": 0
},
"value": "Comp",
"optional": false
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}