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

148 lines
3.2 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 82,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 35,
"end": 36,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": true,
"params": [],
"decorators": [],
"span": {
"start": 18,
"end": 59,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 38,
"end": 58,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 40,
"end": 58,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 40,
"end": 46,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 49,
"end": 58,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 61,
"end": 82,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 65,
"end": 82,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 65,
"end": 67,
"ctxt": 0
},
"value": "gg",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 70,
"end": 82,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 70,
"end": 73,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 77,
"end": 82,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}