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

264 lines
7.3 KiB
JSON

{
"type": "Script",
"span": {
"start": 116,
"end": 193,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 116,
"end": 169,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 122,
"end": 168,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 126,
"end": 168,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 159,
"end": 168,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 128,
"end": 155,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 130,
"end": 155,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 130,
"end": 143,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 132,
"end": 141,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "d",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 133,
"end": 141,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 135,
"end": 141,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 146,
"end": 155,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 170,
"end": 193,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 170,
"end": 192,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 170,
"end": 190,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 171,
"end": 189,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 172,
"end": 182,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "OptionalChainingExpression",
"span": {
"start": 176,
"end": 182,
"ctxt": 0
},
"questionDotToken": {
"start": 179,
"end": 180,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 176,
"end": 182,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 176,
"end": 179,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 187,
"end": 189,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}