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

1034 lines
33 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 529,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 1,
"end": 529,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 8,
"end": 21,
"ctxt": 0
},
"value": "CallSignature",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 22,
"end": 529,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 45,
"end": 49,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 50,
"end": 73,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 50,
"end": 73,
"ctxt": 0
},
"value": "cb",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 52,
"end": 73,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 54,
"end": 73,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 55,
"end": 64,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 56,
"end": 64,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 58,
"end": 64,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 66,
"end": 73,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 69,
"end": 73,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 28,
"end": 86,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 74,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 76,
"end": 85,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 83,
"end": 85,
"ctxt": 0
},
"value": "cb",
"optional": false
},
"typeArguments": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 108,
"end": 112,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 113,
"end": 120,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 113,
"end": 120,
"ctxt": 0
},
"value": "cb",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 115,
"end": 120,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 117,
"end": 120,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 91,
"end": 127,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 121,
"end": 126,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 123,
"end": 126,
"ctxt": 0
},
"kind": "any"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 132,
"end": 163,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 136,
"end": 162,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 140,
"end": 162,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 145,
"end": 161,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 146,
"end": 155,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 147,
"end": 155,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 149,
"end": 155,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"body": {
"type": "NumericLiteral",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 200,
"end": 231,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 204,
"end": 230,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 204,
"end": 206,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 209,
"end": 230,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 209,
"end": 213,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 214,
"end": 229,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 218,
"end": 222,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 219,
"end": 222,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"body": {
"type": "StringLiteral",
"span": {
"start": 227,
"end": 229,
"ctxt": 0
},
"value": "",
"raw": "''"
},
"async": false,
"generator": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 214,
"end": 217,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 286,
"end": 290,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 291,
"end": 325,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 291,
"end": 325,
"ctxt": 0
},
"value": "cb",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 293,
"end": 325,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 295,
"end": 325,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 296,
"end": 305,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 297,
"end": 305,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 299,
"end": 305,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 307,
"end": 316,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 308,
"end": 316,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 310,
"end": 316,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 318,
"end": 325,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 321,
"end": 325,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 269,
"end": 338,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 326,
"end": 337,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 328,
"end": 337,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 335,
"end": 337,
"ctxt": 0
},
"value": "cb",
"optional": false
},
"typeArguments": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 360,
"end": 364,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 365,
"end": 372,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 365,
"end": 372,
"ctxt": 0
},
"value": "cb",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 367,
"end": 372,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 369,
"end": 372,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 343,
"end": 379,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 373,
"end": 378,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 375,
"end": 378,
"ctxt": 0
},
"kind": "any"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 384,
"end": 427,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 388,
"end": 426,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 388,
"end": 390,
"ctxt": 0
},
"value": "r3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 393,
"end": 426,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 393,
"end": 397,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 398,
"end": 425,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 399,
"end": 408,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 400,
"end": 408,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 402,
"end": 408,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 410,
"end": 419,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 411,
"end": 419,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 413,
"end": 419,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"body": {
"type": "NumericLiteral",
"span": {
"start": 424,
"end": 425,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 464,
"end": 495,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 468,
"end": 494,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 468,
"end": 470,
"ctxt": 0
},
"value": "r4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 473,
"end": 494,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 473,
"end": 477,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 478,
"end": 493,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 482,
"end": 486,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 483,
"end": 486,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"body": {
"type": "StringLiteral",
"span": {
"start": 491,
"end": 493,
"ctxt": 0
},
"value": "",
"raw": "''"
},
"async": false,
"generator": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 478,
"end": 481,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 479,
"end": 480,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 479,
"end": 480,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
]
}
}
],
"interpreter": null
}