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

183 lines
5.0 KiB
JSON

{
"type": "Script",
"span": {
"start": 101,
"end": 188,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 101,
"end": 188,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 107,
"end": 187,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"value": "test",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 114,
"end": 187,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 115,
"end": 130,
"ctxt": 0
},
"value": "names",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 120,
"end": 130,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 122,
"end": 130,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 122,
"end": 128,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"body": {
"type": "CallExpression",
"span": {
"start": 166,
"end": 187,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 166,
"end": 179,
"ctxt": 0
},
"questionDotToken": {
"start": 171,
"end": 172,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 166,
"end": 179,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 166,
"end": 171,
"ctxt": 0
},
"value": "names",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 173,
"end": 179,
"ctxt": 0
},
"value": "filter",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 180,
"end": 186,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "x",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
}
],
"interpreter": null
}