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

1448 lines
34 KiB
JSON

{
"type": "Script",
"span": {
"start": 86,
"end": 561,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 95,
"end": 98,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 117,
"end": 121,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 117,
"end": 121,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 118,
"end": 121,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 86,
"end": 126,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 123,
"end": 126,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 98,
"end": 116,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 99,
"end": 115,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 127,
"end": 143,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 131,
"end": 142,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 135,
"end": 142,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 135,
"end": 138,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 139,
"end": 141,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 144,
"end": 155,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 148,
"end": 154,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 152,
"end": 154,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 156,
"end": 172,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 160,
"end": 171,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 164,
"end": 171,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 164,
"end": 167,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 168,
"end": 170,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 174,
"end": 236,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 206,
"end": 234,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 206,
"end": 217,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 218,
"end": 229,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 225,
"end": 229,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 226,
"end": 229,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 228,
"end": 229,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 228,
"end": 229,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 231,
"end": 234,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 181,
"end": 199,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 182,
"end": 198,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 192,
"end": 198,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 192,
"end": 198,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 238,
"end": 257,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 242,
"end": 256,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 242,
"end": 244,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 247,
"end": 256,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 253,
"end": 255,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 259,
"end": 302,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 270,
"end": 288,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 271,
"end": 287,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 271,
"end": 272,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 281,
"end": 287,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 281,
"end": 287,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 289,
"end": 302,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 295,
"end": 300,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 296,
"end": 299,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 303,
"end": 316,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 307,
"end": 315,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 308,
"end": 315,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 310,
"end": 315,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 310,
"end": 311,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 311,
"end": 315,
"ctxt": 0
},
"params": [
{
"type": "TsTypeLiteral",
"span": {
"start": 312,
"end": 314,
"ctxt": 0
},
"members": []
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 344,
"end": 348,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 363,
"end": 367,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 363,
"end": 367,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 364,
"end": 367,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 335,
"end": 372,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 369,
"end": 372,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 348,
"end": 362,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 349,
"end": 361,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 349,
"end": 350,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 359,
"end": 361,
"ctxt": 0
},
"members": []
},
"default": null
}
]
},
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 373,
"end": 390,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 377,
"end": 389,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 377,
"end": 378,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 381,
"end": 389,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 381,
"end": 385,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 386,
"end": 388,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 391,
"end": 402,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 395,
"end": 401,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 399,
"end": 401,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 403,
"end": 420,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 407,
"end": 419,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 407,
"end": 408,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 411,
"end": 419,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 411,
"end": 415,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 416,
"end": 418,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 428,
"end": 430,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"declare": false,
"span": {
"start": 422,
"end": 481,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 451,
"end": 479,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 451,
"end": 462,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 463,
"end": 474,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 470,
"end": 474,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 471,
"end": 474,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 473,
"end": 474,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 473,
"end": 474,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 476,
"end": 479,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 430,
"end": 444,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 431,
"end": 443,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 431,
"end": 432,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 441,
"end": 443,
"ctxt": 0
},
"members": []
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 483,
"end": 503,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 487,
"end": 502,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 487,
"end": 489,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 492,
"end": 502,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 496,
"end": 498,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 499,
"end": 501,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 505,
"end": 545,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 515,
"end": 517,
"ctxt": 0
},
"value": "I2",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 517,
"end": 531,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 518,
"end": 530,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 518,
"end": 519,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 528,
"end": 530,
"ctxt": 0
},
"members": []
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 532,
"end": 545,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 538,
"end": 543,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 538,
"end": 539,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 539,
"end": 542,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 541,
"end": 542,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 541,
"end": 542,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 546,
"end": 561,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 550,
"end": 560,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 550,
"end": 552,
"ctxt": 0
},
"value": "i2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 552,
"end": 560,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 554,
"end": 560,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 554,
"end": 556,
"ctxt": 0
},
"value": "I2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 556,
"end": 560,
"ctxt": 0
},
"params": [
{
"type": "TsTypeLiteral",
"span": {
"start": 557,
"end": 559,
"ctxt": 0
},
"members": []
}
]
}
}
}
},
"init": null,
"definite": false
}
]
}
],
"interpreter": null
}