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

384 lines
11 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 663,
"end": 795,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 663,
"end": 703,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 667,
"end": 703,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 667,
"end": 669,
"ctxt": 0
},
"value": "a0",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 669,
"end": 703,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 671,
"end": 703,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 672,
"end": 681,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 673,
"end": 681,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 675,
"end": 681,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 683,
"end": 692,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 684,
"end": 692,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 686,
"end": 692,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 694,
"end": 703,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 697,
"end": 703,
"ctxt": 0
},
"kind": "number"
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 704,
"end": 759,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 708,
"end": 758,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 708,
"end": 710,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 710,
"end": 758,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 712,
"end": 758,
"ctxt": 0
},
"types": [
{
"type": "TsTypeQuery",
"span": {
"start": 712,
"end": 721,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 719,
"end": 721,
"ctxt": 0
},
"value": "a0",
"optional": false
},
"typeArguments": null
},
{
"type": "TsParenthesizedType",
"span": {
"start": 724,
"end": 758,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 725,
"end": 757,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 726,
"end": 735,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 727,
"end": 735,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 729,
"end": 735,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 737,
"end": 746,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 738,
"end": 746,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 740,
"end": 746,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 748,
"end": 757,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 751,
"end": 757,
"ctxt": 0
},
"kind": "string"
}
}
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 760,
"end": 795,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 760,
"end": 795,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 760,
"end": 762,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 765,
"end": 795,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 766,
"end": 769,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 771,
"end": 774,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 779,
"end": 795,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 781,
"end": 793,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 788,
"end": 792,
"ctxt": 0
},
"value": true
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
],
"interpreter": null
}