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

285 lines
7.0 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 44,
"end": 149,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 44,
"end": 74,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 54,
"end": 55,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 56,
"end": 74,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 62,
"end": 72,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 62,
"end": 63,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 63,
"end": 71,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 65,
"end": 71,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 76,
"end": 149,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 94,
"end": 100,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 94,
"end": 100,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 95,
"end": 100,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 83,
"end": 149,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 110,
"end": 149,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 116,
"end": 147,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 123,
"end": 146,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 123,
"end": 133,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "MemberExpression",
"span": {
"start": 130,
"end": 133,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 138,
"end": 146,
"ctxt": 0
},
"value": "number",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 101,
"end": 109,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypePredicate",
"span": {
"start": 103,
"end": 109,
"ctxt": 0
},
"asserts": false,
"paramName": {
"type": "Identifier",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": null
}
}
}
}
}
}
],
"interpreter": null
}