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

998 lines
27 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 112,
"end": 627,
"ctxt": 0
},
"body": [
{
"type": "ImportDeclaration",
"span": {
"start": 112,
"end": 143,
"ctxt": 0
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"span": {
"start": 119,
"end": 129,
"ctxt": 0
},
"local": {
"type": "Identifier",
"span": {
"start": 124,
"end": 129,
"ctxt": 0
},
"value": "React",
"optional": false
}
}
],
"source": {
"type": "StringLiteral",
"span": {
"start": 135,
"end": 142,
"ctxt": 0
},
"value": "react",
"raw": "\"react\""
},
"typeOnly": false,
"asserts": null
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 145,
"end": 182,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 166,
"ctxt": 0
},
"value": "ErrorResult",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 167,
"end": 182,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 169,
"end": 180,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 169,
"end": 174,
"ctxt": 0
},
"value": "error",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 176,
"end": 180,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 176,
"end": 180,
"ctxt": 0
},
"value": true
}
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 184,
"end": 336,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 194,
"end": 210,
"ctxt": 0
},
"value": "AsyncLoaderProps",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 210,
"end": 219,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 211,
"end": 218,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 211,
"end": 218,
"ctxt": 0
},
"value": "TResult",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 220,
"end": 336,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 226,
"end": 265,
"ctxt": 0
},
"readonly": true,
"key": {
"type": "Identifier",
"span": {
"start": 235,
"end": 240,
"ctxt": 0
},
"value": "prop1",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 240,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 242,
"end": 264,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 245,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 248,
"end": 264,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 248,
"end": 255,
"ctxt": 0
},
"value": "Promise",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 255,
"end": 264,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 256,
"end": 263,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 256,
"end": 263,
"ctxt": 0
},
"value": "TResult",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 271,
"end": 334,
"ctxt": 0
},
"readonly": true,
"key": {
"type": "Identifier",
"span": {
"start": 280,
"end": 285,
"ctxt": 0
},
"value": "prop2",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 285,
"end": 333,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 287,
"end": 333,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 288,
"end": 325,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 294,
"end": 325,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 296,
"end": 325,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 296,
"end": 303,
"ctxt": 0
},
"value": "Exclude",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 303,
"end": 325,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 304,
"end": 311,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 304,
"end": 311,
"ctxt": 0
},
"value": "TResult",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 313,
"end": 324,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 313,
"end": 324,
"ctxt": 0
},
"value": "ErrorResult",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 327,
"end": 333,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 330,
"end": 333,
"ctxt": 0
},
"kind": "any"
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 344,
"end": 355,
"ctxt": 0
},
"value": "AsyncLoader",
"optional": false
},
"declare": false,
"span": {
"start": 338,
"end": 449,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 422,
"end": 447,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 422,
"end": 428,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 422,
"end": 447,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 431,
"end": 447,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 433,
"end": 445,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 440,
"end": 444,
"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": 373,
"end": 388,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 373,
"end": 378,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 379,
"end": 388,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 355,
"end": 364,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 356,
"end": 363,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 356,
"end": 363,
"ctxt": 0
},
"value": "TResult",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 388,
"end": 415,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 389,
"end": 414,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 389,
"end": 405,
"ctxt": 0
},
"value": "AsyncLoaderProps",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 405,
"end": 414,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 406,
"end": 413,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 406,
"end": 413,
"ctxt": 0
},
"value": "TResult",
"optional": false
},
"typeParams": null
}
]
}
}
]
},
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 466,
"end": 470,
"ctxt": 0
},
"value": "load",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 451,
"end": 548,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 515,
"end": 548,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 521,
"end": 546,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 528,
"end": 545,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 530,
"end": 537,
"ctxt": 0
},
"value": "success",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 539,
"end": 543,
"ctxt": 0
},
"value": true
}
}
]
}
}
]
},
"generator": false,
"async": true,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 472,
"end": 514,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 474,
"end": 514,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 474,
"end": 481,
"ctxt": 0
},
"value": "Promise",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 481,
"end": 514,
"ctxt": 0
},
"params": [
{
"type": "TsUnionType",
"span": {
"start": 482,
"end": 513,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 482,
"end": 499,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 484,
"end": 497,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 484,
"end": 491,
"ctxt": 0
},
"value": "success",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 491,
"end": 497,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 493,
"end": 497,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 493,
"end": 497,
"ctxt": 0
},
"value": true
}
}
},
"typeParams": null
}
]
},
{
"type": "TsTypeReference",
"span": {
"start": 502,
"end": 513,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 502,
"end": 513,
"ctxt": 0
},
"value": "ErrorResult",
"optional": false
},
"typeParams": null
}
]
}
]
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 550,
"end": 627,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 556,
"end": 626,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 556,
"end": 562,
"ctxt": 0
},
"value": "loader",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 565,
"end": 626,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 566,
"end": 577,
"ctxt": 0
},
"value": "AsyncLoader",
"optional": false
},
"span": {
"start": 565,
"end": 626,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 582,
"end": 594,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 582,
"end": 587,
"ctxt": 0
},
"value": "prop1",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 588,
"end": 594,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 589,
"end": 593,
"ctxt": 0
},
"value": "load",
"optional": false
}
}
},
{
"type": "JSXAttribute",
"span": {
"start": 599,
"end": 623,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 599,
"end": 604,
"ctxt": 0
},
"value": "prop2",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 605,
"end": 623,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 606,
"end": 622,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 606,
"end": 612,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 616,
"end": 622,
"ctxt": 0
},
"value": "result",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
}
],
"interpreter": null
}