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

144 lines
3.1 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 83,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": true,
"params": [],
"decorators": [],
"span": {
"start": 19,
"end": 60,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 39,
"end": 59,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 41,
"end": 59,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 41,
"end": 47,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 50,
"end": 59,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 62,
"end": 83,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 66,
"end": 83,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 66,
"end": 68,
"ctxt": 0
},
"value": "gg",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 71,
"end": 83,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 71,
"end": 74,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 78,
"end": 83,
"ctxt": 0
},
"value": "foo",
"raw": "'foo'"
}
},
"definite": false
}
]
}
],
"interpreter": null
}