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

181 lines
4.3 KiB
JSON

{
"type": "Module",
"span": {
"start": 45,
"end": 121,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 45,
"end": 121,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 66,
"end": 69,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 52,
"end": 121,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 84,
"end": 121,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 90,
"end": 119,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 97,
"end": 118,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 97,
"end": 105,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 110,
"end": 118,
"ctxt": 0
},
"value": "number",
"raw": "\"number\""
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 70,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypePredicate",
"span": {
"start": 72,
"end": 83,
"ctxt": 0
},
"asserts": false,
"paramName": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"kind": "number"
}
}
}
}
}
}
],
"interpreter": null
}