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

1099 lines
29 KiB
JSON

{
"type": "Module",
"span": {
"start": 115,
"end": 641,
"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": 219,
"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": 219,
"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": 217,
"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": 216,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 210,
"end": 216,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 210,
"end": 216,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 227,
"end": 233,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"declare": false,
"span": {
"start": 221,
"end": 330,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 274,
"end": 328,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 274,
"end": 280,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 274,
"end": 328,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 283,
"end": 328,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 293,
"end": 322,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 300,
"end": 322,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 301,
"end": 321,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 302,
"end": 305,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 301,
"end": 306,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 306,
"end": 315,
"ctxt": 0
},
"value": "My Button",
"raw": "My Button"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 315,
"end": 321,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 317,
"end": 320,
"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": 242,
"end": 257,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 242,
"end": 247,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 248,
"end": 257,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 257,
"end": 267,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 258,
"end": 261,
"ctxt": 0
},
"kind": "any"
},
{
"type": "TsKeywordType",
"span": {
"start": 263,
"end": 266,
"ctxt": 0
},
"kind": "any"
}
]
},
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 341,
"end": 345,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 346,
"end": 353,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 346,
"end": 353,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 347,
"end": 353,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 349,
"end": 353,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 349,
"end": 353,
"ctxt": 0
},
"value": "Prop",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 332,
"end": 387,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 355,
"end": 387,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 361,
"end": 385,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 368,
"end": 384,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 369,
"end": 372,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 368,
"end": 373,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXExpressionContainer",
"span": {
"start": 373,
"end": 378,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 374,
"end": 377,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 374,
"end": 375,
"ctxt": 0
},
"value": "p",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 376,
"end": 377,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 378,
"end": 384,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 380,
"end": 383,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 421,
"end": 452,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 425,
"end": 451,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 425,
"end": 426,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 429,
"end": 451,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 430,
"end": 434,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 429,
"end": 451,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 435,
"end": 441,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 435,
"end": 436,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 437,
"end": 441,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 438,
"end": 440,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 442,
"end": 448,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 442,
"end": 443,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 444,
"end": 448,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 512,
"end": 577,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 516,
"end": 576,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 516,
"end": 518,
"ctxt": 0
},
"value": "k1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 525,
"end": 576,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 526,
"end": 530,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 525,
"end": 545,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 531,
"end": 537,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 531,
"end": 532,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 533,
"end": 537,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 534,
"end": 536,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 538,
"end": 544,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 538,
"end": 539,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 540,
"end": 544,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 545,
"end": 554,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXElement",
"span": {
"start": 554,
"end": 564,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 555,
"end": 561,
"ctxt": 0
},
"value": "Button",
"optional": false
},
"span": {
"start": 554,
"end": 564,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
{
"type": "JSXText",
"span": {
"start": 564,
"end": 569,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 569,
"end": 576,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 571,
"end": 575,
"ctxt": 0
},
"value": "Comp",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 578,
"end": 641,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 582,
"end": 640,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 582,
"end": 584,
"ctxt": 0
},
"value": "k2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 591,
"end": 640,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 592,
"end": 596,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 591,
"end": 611,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 597,
"end": 603,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 597,
"end": 598,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 599,
"end": 603,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 600,
"end": 602,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 604,
"end": 610,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 604,
"end": 605,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 606,
"end": 610,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 611,
"end": 620,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXExpressionContainer",
"span": {
"start": 620,
"end": 628,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 621,
"end": 627,
"ctxt": 0
},
"value": "Button",
"optional": false
}
},
{
"type": "JSXText",
"span": {
"start": 628,
"end": 633,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 633,
"end": 640,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 635,
"end": 639,
"ctxt": 0
},
"value": "Comp",
"optional": false
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}