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

384 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 662,
"end": 794,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 662,
"end": 702,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 666,
"end": 702,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 666,
"end": 668,
"ctxt": 0
},
"value": "a0",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 668,
"end": 702,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 670,
"end": 702,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 671,
"end": 680,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 672,
"end": 680,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 674,
"end": 680,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 682,
"end": 691,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 683,
"end": 691,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 685,
"end": 691,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 693,
"end": 702,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 696,
"end": 702,
"ctxt": 0
},
"kind": "number"
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 703,
"end": 758,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 707,
"end": 757,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 707,
"end": 709,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 709,
"end": 757,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 711,
"end": 757,
"ctxt": 0
},
"types": [
{
"type": "TsTypeQuery",
"span": {
"start": 711,
"end": 720,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 718,
"end": 720,
"ctxt": 0
},
"value": "a0",
"optional": false
},
"typeArguments": null
},
{
"type": "TsParenthesizedType",
"span": {
"start": 723,
"end": 757,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 724,
"end": 756,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 725,
"end": 734,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 726,
"end": 734,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 728,
"end": 734,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 736,
"end": 745,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 737,
"end": 745,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 739,
"end": 745,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 747,
"end": 756,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 750,
"end": 756,
"ctxt": 0
},
"kind": "string"
}
}
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 759,
"end": 794,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 759,
"end": 794,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 759,
"end": 761,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 764,
"end": 794,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 765,
"end": 768,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 770,
"end": 773,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 778,
"end": 794,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 780,
"end": 792,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 787,
"end": 791,
"ctxt": 0
},
"value": true
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
],
"interpreter": null
}