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

976 lines
26 KiB
JSON

{
"type": "Module",
"span": {
"start": 115,
"end": 485,
"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": 232,
"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": 232,
"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": 230,
"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": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 210,
"end": 230,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 210,
"end": 216,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsTypeReference",
"span": {
"start": 219,
"end": 230,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 219,
"end": 222,
"ctxt": 0
},
"value": "JSX",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 223,
"end": 230,
"ctxt": 0
},
"value": "Element",
"optional": false
}
},
"typeParams": null
}
]
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 243,
"end": 247,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 248,
"end": 255,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 248,
"end": 255,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 249,
"end": 255,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 251,
"end": 255,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 251,
"end": 255,
"ctxt": 0
},
"value": "Prop",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 234,
"end": 289,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 257,
"end": 289,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 263,
"end": 287,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 270,
"end": 286,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 271,
"end": 274,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 270,
"end": 275,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXExpressionContainer",
"span": {
"start": 275,
"end": 280,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 276,
"end": 279,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 276,
"end": 277,
"ctxt": 0
},
"value": "p",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 278,
"end": 279,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 280,
"end": 286,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 282,
"end": 285,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 297,
"end": 344,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 301,
"end": 343,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 305,
"end": 343,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 306,
"end": 310,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 305,
"end": 343,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 311,
"end": 317,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 311,
"end": 312,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 313,
"end": 317,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 314,
"end": 316,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 318,
"end": 324,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 318,
"end": 319,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 320,
"end": 324,
"ctxt": 0
},
"value": "hi",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 325,
"end": 340,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 325,
"end": 333,
"ctxt": 0
},
"value": "children",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 335,
"end": 340,
"ctxt": 0
},
"value": "lol",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 345,
"end": 409,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 349,
"end": 408,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 349,
"end": 351,
"ctxt": 0
},
"value": "k1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 358,
"end": 408,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 359,
"end": 363,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 358,
"end": 378,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 364,
"end": 370,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 364,
"end": 365,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 366,
"end": 370,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 367,
"end": 369,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 371,
"end": 377,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 371,
"end": 372,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 373,
"end": 377,
"ctxt": 0
},
"value": "hi",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 378,
"end": 401,
"ctxt": 0
},
"value": "\n\n hi hi hi!\n\n ",
"raw": "\n\n hi hi hi!\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 401,
"end": 408,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 403,
"end": 407,
"ctxt": 0
},
"value": "Comp",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 410,
"end": 485,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 414,
"end": 484,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 414,
"end": 416,
"ctxt": 0
},
"value": "k2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 423,
"end": 484,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 424,
"end": 428,
"ctxt": 0
},
"value": "Comp",
"optional": false
},
"span": {
"start": 423,
"end": 443,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 429,
"end": 435,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 429,
"end": 430,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 431,
"end": 435,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 432,
"end": 434,
"ctxt": 0
},
"value": 10.0
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 436,
"end": 442,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 436,
"end": 437,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 438,
"end": 442,
"ctxt": 0
},
"value": "hi",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 443,
"end": 452,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
},
{
"type": "JSXElement",
"span": {
"start": 452,
"end": 472,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 453,
"end": 456,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 452,
"end": 457,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 457,
"end": 466,
"ctxt": 0
},
"value": "hi hi hi!",
"raw": "hi hi hi!"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 466,
"end": 472,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 468,
"end": 471,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
},
{
"type": "JSXText",
"span": {
"start": 472,
"end": 477,
"ctxt": 0
},
"value": "\n\n ",
"raw": "\n\n "
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 477,
"end": 484,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 479,
"end": 483,
"ctxt": 0
},
"value": "Comp",
"optional": false
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}