swc/crates/swc_ecma_parser/tests/tsc/tsxSpreadChildren.json
2022-02-04 17:08:38 +09:00

1235 lines
36 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 555,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 18,
"end": 117,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 33,
"end": 36,
"ctxt": 0
},
"value": "JSX",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 37,
"end": 117,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 40,
"end": 61,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 50,
"end": 57,
"ctxt": 0
},
"value": "Element",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 58,
"end": 61,
"ctxt": 0
},
"body": []
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 63,
"end": 115,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 90,
"ctxt": 0
},
"value": "IntrinsicElements",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 91,
"end": 115,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 96,
"end": 105,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 97,
"end": 105,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 106,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"kind": "any"
}
},
"readonly": false,
"static": false,
"span": {
"start": 95,
"end": 112,
"ctxt": 0
}
}
]
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 118,
"end": 141,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 130,
"end": 140,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 130,
"end": 135,
"ctxt": 0
},
"value": "React",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 135,
"end": 140,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 137,
"end": 140,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 143,
"end": 199,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 153,
"end": 161,
"ctxt": 0
},
"value": "TodoProp",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 162,
"end": 199,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 168,
"end": 179,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 168,
"end": 170,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 170,
"end": 178,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 172,
"end": 178,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 184,
"end": 197,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 184,
"end": 188,
"ctxt": 0
},
"value": "todo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 188,
"end": 196,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 190,
"end": 196,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 200,
"end": 250,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 210,
"end": 223,
"ctxt": 0
},
"value": "TodoListProps",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 224,
"end": 250,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 230,
"end": 248,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 230,
"end": 235,
"ctxt": 0
},
"value": "todos",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 235,
"end": 247,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 237,
"end": 247,
"ctxt": 0
},
"elemType": {
"type": "TsTypeReference",
"span": {
"start": 237,
"end": 245,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 237,
"end": 245,
"ctxt": 0
},
"value": "TodoProp",
"optional": false
},
"typeParams": null
}
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 260,
"end": 264,
"ctxt": 0
},
"value": "Todo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 265,
"end": 300,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 265,
"end": 300,
"ctxt": 0
},
"value": "prop",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 269,
"end": 300,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 271,
"end": 300,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 273,
"end": 285,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 273,
"end": 276,
"ctxt": 0
},
"value": "key",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 276,
"end": 284,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 278,
"end": 284,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 286,
"end": 298,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 286,
"end": 290,
"ctxt": 0
},
"value": "todo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 290,
"end": 298,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 292,
"end": 298,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 251,
"end": 362,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 302,
"end": 362,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 308,
"end": 360,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 315,
"end": 359,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 316,
"end": 319,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 315,
"end": 320,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXExpressionContainer",
"span": {
"start": 320,
"end": 353,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 321,
"end": 352,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "CallExpression",
"span": {
"start": 321,
"end": 340,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 338,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 329,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 321,
"end": 325,
"ctxt": 0
},
"value": "prop",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 326,
"end": 329,
"ctxt": 0
},
"value": "key",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 330,
"end": 338,
"ctxt": 0
},
"value": "toString",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 343,
"end": 352,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 343,
"end": 347,
"ctxt": 0
},
"value": "prop",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 348,
"end": 352,
"ctxt": 0
},
"value": "todo",
"optional": false
}
}
}
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 353,
"end": 359,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 355,
"end": 358,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 372,
"end": 380,
"ctxt": 0
},
"value": "TodoList",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 381,
"end": 405,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 381,
"end": 405,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 383,
"end": 388,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 383,
"end": 388,
"ctxt": 0
},
"value": "todos",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 390,
"end": 405,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 392,
"end": 405,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 392,
"end": 405,
"ctxt": 0
},
"value": "TodoListProps",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 363,
"end": 510,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 407,
"end": 510,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 413,
"end": 508,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 420,
"end": 507,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 421,
"end": 424,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 420,
"end": 425,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 425,
"end": 434,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXSpreadChild",
"span": {
"start": 434,
"end": 496,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 438,
"end": 495,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 438,
"end": 447,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 438,
"end": 443,
"ctxt": 0
},
"value": "todos",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 444,
"end": 447,
"ctxt": 0
},
"value": "map",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 448,
"end": 494,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 448,
"end": 452,
"ctxt": 0
},
"value": "todo",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "JSXElement",
"span": {
"start": 456,
"end": 494,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 457,
"end": 461,
"ctxt": 0
},
"value": "Todo",
"optional": false
},
"span": {
"start": 456,
"end": 494,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 462,
"end": 475,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 462,
"end": 465,
"ctxt": 0
},
"value": "key",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 466,
"end": 475,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 467,
"end": 474,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 467,
"end": 471,
"ctxt": 0
},
"value": "todo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 472,
"end": 474,
"ctxt": 0
},
"value": "id",
"optional": false
}
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 476,
"end": 492,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 476,
"end": 480,
"ctxt": 0
},
"value": "todo",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 481,
"end": 492,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 482,
"end": 491,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 482,
"end": 486,
"ctxt": 0
},
"value": "todo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 487,
"end": 491,
"ctxt": 0
},
"value": "todo",
"optional": false
}
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
{
"type": "JSXText",
"span": {
"start": 496,
"end": 501,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 501,
"end": 507,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 503,
"end": 506,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 511,
"end": 532,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 515,
"end": 531,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 515,
"end": 516,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 516,
"end": 531,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 518,
"end": 531,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 518,
"end": 531,
"ctxt": 0
},
"value": "TodoListProps",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 537,
"end": 555,
"ctxt": 0
},
"expression": {
"type": "JSXElement",
"span": {
"start": 537,
"end": 555,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 538,
"end": 546,
"ctxt": 0
},
"value": "TodoList",
"optional": false
},
"span": {
"start": 537,
"end": 555,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 548,
"end": 551,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 551,
"end": 552,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
}
}
],
"interpreter": null
}