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

1430 lines
34 KiB
JSON

{
"type": "Script",
"span": {
"start": 88,
"end": 594,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 119,
"end": 123,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 119,
"end": 123,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 120,
"end": 123,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 88,
"end": 128,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 125,
"end": 128,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 100,
"end": 118,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 101,
"end": 117,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 111,
"end": 117,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 111,
"end": 117,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 130,
"end": 146,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 134,
"end": 145,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 138,
"end": 145,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 138,
"end": 141,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 142,
"end": 144,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 148,
"end": 159,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 152,
"end": 158,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 152,
"end": 153,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 156,
"end": 158,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 161,
"end": 177,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 165,
"end": 176,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 169,
"end": 176,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 169,
"end": 172,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 173,
"end": 175,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 181,
"end": 245,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 214,
"end": 242,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 214,
"end": 225,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 226,
"end": 237,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 233,
"end": 237,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 234,
"end": 237,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 239,
"end": 242,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 188,
"end": 206,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 189,
"end": 205,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 199,
"end": 205,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 199,
"end": 205,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 249,
"end": 268,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 253,
"end": 267,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 253,
"end": 255,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 258,
"end": 267,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 264,
"end": 266,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 272,
"end": 317,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 283,
"end": 301,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 284,
"end": 300,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 284,
"end": 285,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 294,
"end": 300,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 294,
"end": 300,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 302,
"end": 317,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 309,
"end": 314,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 310,
"end": 313,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 319,
"end": 332,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 323,
"end": 331,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 323,
"end": 324,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 324,
"end": 331,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 326,
"end": 331,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 326,
"end": 327,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 327,
"end": 331,
"ctxt": 0
},
"params": [
{
"type": "TsTypeLiteral",
"span": {
"start": 328,
"end": 330,
"ctxt": 0
},
"members": []
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 363,
"end": 367,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 382,
"end": 386,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 382,
"end": 386,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 383,
"end": 386,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 354,
"end": 391,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 388,
"end": 391,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 367,
"end": 381,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 368,
"end": 380,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 368,
"end": 369,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 378,
"end": 380,
"ctxt": 0
},
"members": []
},
"default": null
}
]
},
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 393,
"end": 410,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 397,
"end": 409,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 397,
"end": 398,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 401,
"end": 409,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 401,
"end": 405,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 406,
"end": 408,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 412,
"end": 423,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 416,
"end": 422,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 416,
"end": 417,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 420,
"end": 422,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 425,
"end": 442,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 429,
"end": 441,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 429,
"end": 430,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 433,
"end": 441,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 433,
"end": 437,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 438,
"end": 440,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 452,
"end": 454,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"declare": false,
"span": {
"start": 446,
"end": 507,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 476,
"end": 504,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 476,
"end": 487,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 488,
"end": 499,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 495,
"end": 499,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 496,
"end": 499,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 501,
"end": 504,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 454,
"end": 468,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 455,
"end": 467,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 465,
"end": 467,
"ctxt": 0
},
"members": []
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 511,
"end": 531,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 515,
"end": 530,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 515,
"end": 517,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 520,
"end": 530,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 524,
"end": 526,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 527,
"end": 529,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 535,
"end": 577,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 545,
"end": 547,
"ctxt": 0
},
"value": "I2",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 547,
"end": 561,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 548,
"end": 560,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 548,
"end": 549,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 558,
"end": 560,
"ctxt": 0
},
"members": []
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 562,
"end": 577,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 569,
"end": 574,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 569,
"end": 570,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 570,
"end": 573,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 572,
"end": 573,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 572,
"end": 573,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 579,
"end": 594,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 583,
"end": 593,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 583,
"end": 585,
"ctxt": 0
},
"value": "i2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 585,
"end": 593,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 587,
"end": 593,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 587,
"end": 589,
"ctxt": 0
},
"value": "I2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 589,
"end": 593,
"ctxt": 0
},
"params": [
{
"type": "TsTypeLiteral",
"span": {
"start": 590,
"end": 592,
"ctxt": 0
},
"members": []
}
]
}
}
}
},
"init": null,
"definite": false
}
]
}
],
"interpreter": null
}