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

193 lines
4.4 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 50,
"end": 122,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 50,
"end": 98,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 60,
"end": 63,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 64,
"end": 98,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 70,
"end": 81,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 72,
"end": 80,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 74,
"end": 80,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 86,
"end": 96,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 87,
"end": 95,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 89,
"end": 95,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 100,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 100,
"end": 121,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 105,
"end": 121,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 110,
"end": 119,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 101,
"end": 104,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 101,
"end": 104,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
}
}
],
"interpreter": null
}