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

193 lines
4.4 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 51,
"end": 123,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 51,
"end": 99,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 61,
"end": 64,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 65,
"end": 99,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 71,
"end": 82,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 81,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 87,
"end": 97,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 88,
"end": 96,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 90,
"end": 96,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 101,
"end": 123,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 101,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 106,
"end": 122,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 111,
"end": 120,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 102,
"end": 105,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 102,
"end": 105,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
}
}
],
"interpreter": null
}