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

289 lines
7.1 KiB
JSON

{
"type": "Script",
"span": {
"start": 23,
"end": 160,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 23,
"end": 69,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 33,
"end": 49,
"ctxt": 0
},
"value": "WithNonPrimitive",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 50,
"end": 69,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 56,
"end": 67,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 59,
"end": 67,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 61,
"end": 67,
"ctxt": 0
},
"kind": "object"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 71,
"end": 119,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 75,
"end": 118,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 76,
"end": 94,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 78,
"end": 94,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 78,
"end": 94,
"ctxt": 0
},
"value": "WithNonPrimitive",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 97,
"end": 118,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 99,
"end": 102,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": {
"type": "ObjectExpression",
"span": {
"start": 104,
"end": 116,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 105,
"end": 108,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 110,
"end": 115,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 121,
"end": 160,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 125,
"end": 159,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 126,
"end": 144,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 128,
"end": 144,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 128,
"end": 144,
"ctxt": 0
},
"value": "WithNonPrimitive",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 147,
"end": 159,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 148,
"end": 151,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 153,
"end": 158,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}