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

736 lines
19 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
"end": 248,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 0,
"end": 26,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 12,
"end": 24,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 12,
"end": 16,
"ctxt": 0
},
"value": "test",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 16,
"end": 24,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 18,
"end": 24,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 34,
"end": 35,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 28,
"end": 65,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 50,
"end": 63,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 50,
"end": 55,
"ctxt": 0
},
"value": "test2",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 55,
"end": 63,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 57,
"end": 63,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
},
"value": "C",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 84,
"end": 93,
"ctxt": 0
},
"value": "testError",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 107,
"end": 131,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 107,
"end": 131,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 131,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 110,
"end": 131,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 111,
"end": 115,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 112,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "Identifier",
"span": {
"start": 117,
"end": 122,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 122,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 124,
"end": 131,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 131,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 67,
"end": 135,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 93,
"end": 106,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 94,
"end": 105,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 132,
"end": 135,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 150,
"end": 182,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 150,
"end": 182,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 150,
"end": 159,
"ctxt": 0
},
"value": "testError",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 160,
"end": 181,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 161,
"end": 166,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "D",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "Identifier",
"span": {
"start": 168,
"end": 170,
"ctxt": 0
},
"value": "t2",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 172,
"end": 174,
"ctxt": 0
},
"value": "t3",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 179,
"end": 181,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 183,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 183,
"end": 215,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 183,
"end": 192,
"ctxt": 0
},
"value": "testError",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 193,
"end": 214,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 194,
"end": 196,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 198,
"end": 203,
"ctxt": 0
},
"value": "t2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 200,
"end": 203,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "D",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "Identifier",
"span": {
"start": 205,
"end": 207,
"ctxt": 0
},
"value": "t3",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 212,
"end": 214,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 216,
"end": 248,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 216,
"end": 248,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 216,
"end": 225,
"ctxt": 0
},
"value": "testError",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 226,
"end": 247,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 227,
"end": 229,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 231,
"end": 233,
"ctxt": 0
},
"value": "t2",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 235,
"end": 240,
"ctxt": 0
},
"value": "t3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 237,
"end": 240,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "D",
"optional": false
},
"typeParams": null
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 245,
"end": 247,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}