swc/crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty3x.json

1060 lines
32 KiB
JSON

{
"type": "Module",
"span": {
"start": 115,
"end": 787,
"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",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 149,
"end": 186,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 164,
"ctxt": 0
},
"value": "IUser",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 165,
"end": 186,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 171,
"end": 184,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 171,
"end": 175,
"ctxt": 0
},
"value": "Name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 175,
"end": 183,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 177,
"end": 183,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 188,
"end": 261,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 198,
"end": 213,
"ctxt": 0
},
"value": "IFetchUserProps",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 214,
"end": 261,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 220,
"end": 259,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 220,
"end": 228,
"ctxt": 0
},
"value": "children",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 228,
"end": 258,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 230,
"end": 258,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 231,
"end": 242,
"ctxt": 0
},
"value": "user",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 235,
"end": 242,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 237,
"end": 242,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 237,
"end": 242,
"ctxt": 0
},
"value": "IUser",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 244,
"end": 258,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 247,
"end": 258,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 247,
"end": 250,
"ctxt": 0
},
"value": "JSX",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 251,
"end": 258,
"ctxt": 0
},
"value": "Element",
"optional": false
}
},
"typeParams": null
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 269,
"end": 278,
"ctxt": 0
},
"value": "FetchUser",
"optional": false
},
"declare": false,
"span": {
"start": 263,
"end": 448,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 331,
"end": 446,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 331,
"end": 337,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 331,
"end": 446,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 340,
"end": 446,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 350,
"end": 440,
"ctxt": 0
},
"argument": {
"type": "ConditionalExpression",
"span": {
"start": 357,
"end": 439,
"ctxt": 0
},
"test": {
"type": "MemberExpression",
"span": {
"start": 357,
"end": 367,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 357,
"end": 361,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 362,
"end": 367,
"ctxt": 0
},
"value": "state",
"optional": false
}
},
"consequent": {
"type": "CallExpression",
"span": {
"start": 382,
"end": 420,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 382,
"end": 401,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 382,
"end": 392,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 382,
"end": 386,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 387,
"end": 392,
"ctxt": 0
},
"value": "props",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 393,
"end": 401,
"ctxt": 0
},
"value": "children",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 402,
"end": 419,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 402,
"end": 412,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 402,
"end": 406,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 407,
"end": 412,
"ctxt": 0
},
"value": "state",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 413,
"end": 419,
"ctxt": 0
},
"value": "result",
"optional": false
}
}
}
],
"typeArguments": null
},
"alternate": {
"type": "NullLiteral",
"span": {
"start": 435,
"end": 439,
"ctxt": 0
}
}
}
}
]
},
"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": 287,
"end": 302,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 287,
"end": 292,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 293,
"end": 302,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 302,
"end": 324,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 303,
"end": 318,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 303,
"end": 318,
"ctxt": 0
},
"value": "IFetchUserProps",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 320,
"end": 323,
"ctxt": 0
},
"kind": "any"
}
]
},
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 465,
"end": 474,
"ctxt": 0
},
"value": "UserName0",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 456,
"end": 620,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 477,
"end": 620,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 483,
"end": 618,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 490,
"end": 617,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 500,
"end": 611,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 501,
"end": 510,
"ctxt": 0
},
"value": "FetchUser",
"optional": false
},
"span": {
"start": 500,
"end": 511,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 511,
"end": 524,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXExpressionContainer",
"span": {
"start": 524,
"end": 590,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 526,
"end": 588,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 526,
"end": 530,
"ctxt": 0
},
"value": "user",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "ParenthesisExpression",
"span": {
"start": 534,
"end": 588,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 552,
"end": 574,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 553,
"end": 555,
"ctxt": 0
},
"value": "h1",
"optional": false
},
"span": {
"start": 552,
"end": 556,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXExpressionContainer",
"span": {
"start": 556,
"end": 569,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 558,
"end": 567,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 558,
"end": 562,
"ctxt": 0
},
"value": "user",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 563,
"end": 567,
"ctxt": 0
},
"value": "Name",
"optional": false
}
}
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 569,
"end": 574,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 571,
"end": 573,
"ctxt": 0
},
"value": "h1",
"optional": false
}
}
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "JSXText",
"span": {
"start": 590,
"end": 599,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 599,
"end": 611,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 601,
"end": 610,
"ctxt": 0
},
"value": "FetchUser",
"optional": false
}
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 631,
"end": 640,
"ctxt": 0
},
"value": "UserName1",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 622,
"end": 787,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 643,
"end": 787,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 649,
"end": 785,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 656,
"end": 784,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 666,
"end": 778,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 667,
"end": 676,
"ctxt": 0
},
"value": "FetchUser",
"optional": false
},
"span": {
"start": 666,
"end": 677,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 677,
"end": 691,
"ctxt": 0
},
"value": "\n\n\n\n ",
"raw": "\n\n\n\n "
},
{
"type": "JSXExpressionContainer",
"span": {
"start": 691,
"end": 757,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 693,
"end": 755,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 693,
"end": 697,
"ctxt": 0
},
"value": "user",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "ParenthesisExpression",
"span": {
"start": 701,
"end": 755,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 719,
"end": 741,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 720,
"end": 722,
"ctxt": 0
},
"value": "h1",
"optional": false
},
"span": {
"start": 719,
"end": 723,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXExpressionContainer",
"span": {
"start": 723,
"end": 736,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 725,
"end": 734,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 725,
"end": 729,
"ctxt": 0
},
"value": "user",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 730,
"end": 734,
"ctxt": 0
},
"value": "Name",
"optional": false
}
}
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 736,
"end": 741,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 738,
"end": 740,
"ctxt": 0
},
"value": "h1",
"optional": false
}
}
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "JSXText",
"span": {
"start": 757,
"end": 766,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 766,
"end": 778,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 768,
"end": 777,
"ctxt": 0
},
"value": "FetchUser",
"optional": false
}
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}