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

1439 lines
38 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 115,
"end": 732,
"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": "VariableDeclaration",
"span": {
"start": 149,
"end": 164,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 155,
"end": 163,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 158,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 161,
"end": 163,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 165,
"end": 198,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 171,
"end": 198,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 171,
"end": 175,
"ctxt": 0
},
"value": "obj1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 175,
"end": 183,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 177,
"end": 183,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 178,
"end": 182,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 178,
"end": 179,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 179,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": 2.0
}
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 186,
"end": 198,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": 2.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 199,
"end": 280,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 205,
"end": 280,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 205,
"end": 209,
"ctxt": 0
},
"value": "obj3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 209,
"end": 240,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 211,
"end": 240,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 212,
"end": 221,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 213,
"end": 220,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 215,
"end": 220,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 215,
"end": 220,
"ctxt": 0
},
"value": false
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 222,
"end": 239,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 222,
"end": 231,
"ctxt": 0
},
"value": "overwrite",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 231,
"end": 239,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 233,
"end": 239,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 243,
"end": 280,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 252,
"end": 257,
"ctxt": 0
},
"value": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 263,
"end": 272,
"ctxt": 0
},
"value": "overwrite",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 274,
"end": 278,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
}
]
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 282,
"end": 344,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 292,
"end": 296,
"ctxt": 0
},
"value": "Prop",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 297,
"end": 344,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 303,
"end": 307,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 303,
"end": 304,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 304,
"end": 307,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"value": 2.0
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 312,
"end": 320,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 313,
"end": 320,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 315,
"end": 320,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 315,
"end": 320,
"ctxt": 0
},
"value": false
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 325,
"end": 342,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 325,
"end": 334,
"ctxt": 0
},
"value": "overwrite",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 334,
"end": 342,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 336,
"end": 342,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 352,
"end": 365,
"ctxt": 0
},
"value": "OverWriteAttr",
"optional": false
},
"declare": false,
"span": {
"start": 346,
"end": 457,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 406,
"end": 455,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 406,
"end": 412,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 406,
"end": 455,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 415,
"end": 455,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 425,
"end": 449,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 432,
"end": 448,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 433,
"end": 436,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 432,
"end": 437,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 437,
"end": 442,
"ctxt": 0
},
"value": "Hello",
"raw": "Hello"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 442,
"end": 448,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 444,
"end": 447,
"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": 374,
"end": 389,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 374,
"end": 379,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 380,
"end": 389,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 389,
"end": 399,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 390,
"end": 394,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 390,
"end": 394,
"ctxt": 0
},
"value": "Prop",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeLiteral",
"span": {
"start": 396,
"end": 398,
"ctxt": 0
},
"members": []
}
]
},
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 459,
"end": 475,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 463,
"end": 474,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 463,
"end": 469,
"ctxt": 0
},
"value": "anyobj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 469,
"end": 474,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 471,
"end": 474,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 486,
"end": 547,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 490,
"end": 547,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 490,
"end": 491,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 494,
"end": 547,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 495,
"end": 508,
"ctxt": 0
},
"value": "OverWriteAttr",
"optional": false
},
"span": {
"start": 494,
"end": 547,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 510,
"end": 513,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 513,
"end": 516,
"ctxt": 0
},
"value": "obj",
"optional": false
}
},
{
"type": "JSXAttribute",
"span": {
"start": 518,
"end": 519,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 518,
"end": 519,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null
},
{
"type": "JSXAttribute",
"span": {
"start": 520,
"end": 534,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 520,
"end": 529,
"ctxt": 0
},
"value": "overwrite",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 530,
"end": 534,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
},
{
"type": "SpreadElement",
"spread": {
"start": 536,
"end": 539,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 539,
"end": 543,
"ctxt": 0
},
"value": "obj1",
"optional": false
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 548,
"end": 620,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 552,
"end": 620,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 552,
"end": 554,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 557,
"end": 620,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 558,
"end": 571,
"ctxt": 0
},
"value": "OverWriteAttr",
"optional": false
},
"span": {
"start": 557,
"end": 620,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 572,
"end": 586,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 572,
"end": 581,
"ctxt": 0
},
"value": "overwrite",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 582,
"end": 586,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
},
{
"type": "SpreadElement",
"spread": {
"start": 588,
"end": 591,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 591,
"end": 595,
"ctxt": 0
},
"value": "obj1",
"optional": false
}
},
{
"type": "JSXAttribute",
"span": {
"start": 597,
"end": 602,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 597,
"end": 598,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 599,
"end": 602,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 600,
"end": 601,
"ctxt": 0
},
"value": 3.0
}
}
},
{
"type": "SpreadElement",
"spread": {
"start": 604,
"end": 607,
"ctxt": 0
},
"arguments": {
"type": "ObjectExpression",
"span": {
"start": 607,
"end": 616,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 608,
"end": 609,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 611,
"end": 615,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 621,
"end": 665,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 625,
"end": 665,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 625,
"end": 627,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 630,
"end": 665,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 631,
"end": 644,
"ctxt": 0
},
"value": "OverWriteAttr",
"optional": false
},
"span": {
"start": 630,
"end": 665,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 646,
"end": 649,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 649,
"end": 655,
"ctxt": 0
},
"value": "anyobj",
"optional": false
}
},
{
"type": "JSXAttribute",
"span": {
"start": 657,
"end": 662,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 657,
"end": 658,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 659,
"end": 662,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 660,
"end": 661,
"ctxt": 0
},
"value": 3.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 666,
"end": 732,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 670,
"end": 732,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 670,
"end": 672,
"ctxt": 0
},
"value": "x3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 675,
"end": 732,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 676,
"end": 689,
"ctxt": 0
},
"value": "OverWriteAttr",
"optional": false
},
"span": {
"start": 675,
"end": 732,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 690,
"end": 704,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 690,
"end": 699,
"ctxt": 0
},
"value": "overwrite",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 700,
"end": 704,
"ctxt": 0
},
"value": "hi",
"raw": "\"hi\""
}
},
{
"type": "SpreadElement",
"spread": {
"start": 706,
"end": 709,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 709,
"end": 713,
"ctxt": 0
},
"value": "obj1",
"optional": false
}
},
{
"type": "SpreadElement",
"spread": {
"start": 716,
"end": 719,
"ctxt": 0
},
"arguments": {
"type": "ObjectExpression",
"span": {
"start": 719,
"end": 728,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 720,
"end": 721,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 723,
"end": 727,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
}
],
"interpreter": null
}