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

965 lines
24 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 115,
"end": 506,
"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": 199,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 169,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 170,
"end": 199,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 176,
"end": 181,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 178,
"end": 181,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": 2.0
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 186,
"end": 197,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 188,
"end": 197,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 190,
"end": 197,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 207,
"end": 210,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"declare": false,
"span": {
"start": 201,
"end": 308,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 257,
"end": 306,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 257,
"end": 263,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 257,
"end": 306,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 266,
"end": 306,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 276,
"end": 300,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 283,
"end": 299,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 284,
"end": 287,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 283,
"end": 288,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 288,
"end": 293,
"ctxt": 0
},
"value": "Hello",
"raw": "Hello"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 293,
"end": 299,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 295,
"end": 298,
"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": 219,
"end": 234,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 219,
"end": 224,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 225,
"end": 234,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 234,
"end": 250,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 235,
"end": 245,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 235,
"end": 245,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeLiteral",
"span": {
"start": 247,
"end": 249,
"ctxt": 0
},
"members": []
}
]
},
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 310,
"end": 337,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 316,
"end": 336,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 319,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 319,
"end": 331,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 321,
"end": 331,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 321,
"end": 331,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 334,
"end": 336,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 338,
"end": 375,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 344,
"end": 375,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 344,
"end": 348,
"ctxt": 0
},
"value": "obj1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 348,
"end": 360,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 350,
"end": 360,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 350,
"end": 360,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 363,
"end": 375,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 369,
"end": 370,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 372,
"end": 373,
"ctxt": 0
},
"value": 2.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 383,
"end": 399,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 387,
"end": 398,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 387,
"end": 388,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 391,
"end": 398,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 392,
"end": 395,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 391,
"end": 398,
"ctxt": 0
},
"attributes": [],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 400,
"end": 425,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 404,
"end": 424,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 408,
"end": 424,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 409,
"end": 412,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 408,
"end": 424,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 414,
"end": 417,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 417,
"end": 420,
"ctxt": 0
},
"value": "obj",
"optional": false
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 426,
"end": 453,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 430,
"end": 452,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 430,
"end": 432,
"ctxt": 0
},
"value": "y1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 435,
"end": 452,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 436,
"end": 439,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 435,
"end": 452,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 441,
"end": 444,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 444,
"end": 448,
"ctxt": 0
},
"value": "obj1",
"optional": false
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 454,
"end": 482,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 458,
"end": 481,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 458,
"end": 460,
"ctxt": 0
},
"value": "y2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 463,
"end": 481,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 464,
"end": 467,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 463,
"end": 481,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 469,
"end": 472,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 472,
"end": 476,
"ctxt": 0
},
"value": "obj1",
"optional": false
}
},
{
"type": "JSXAttribute",
"span": {
"start": 478,
"end": 479,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 478,
"end": 479,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 483,
"end": 506,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 487,
"end": 505,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 487,
"end": 489,
"ctxt": 0
},
"value": "y3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 492,
"end": 505,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 493,
"end": 496,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 492,
"end": 505,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 497,
"end": 502,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 497,
"end": 498,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 499,
"end": 502,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 500,
"end": 501,
"ctxt": 0
},
"value": 2.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
}
],
"interpreter": null
}