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

193 lines
4.4 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 53,
"end": 130,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 53,
"end": 104,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 67,
"end": 104,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 74,
"end": 85,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 76,
"end": 84,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 78,
"end": 84,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 91,
"end": 101,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 92,
"end": 100,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 94,
"end": 100,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 108,
"end": 130,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 108,
"end": 129,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 113,
"end": 129,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 118,
"end": 127,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
}
}
],
"interpreter": null
}