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

462 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 11,
"end": 199,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 11,
"end": 72,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 16,
"end": 23,
"ctxt": 0
},
"value": "ObjType",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 26,
"end": 72,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 30,
"end": 41,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 30,
"end": 33,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 41,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 44,
"end": 55,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 47,
"end": 55,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 49,
"end": 55,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 58,
"end": 70,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 58,
"end": 62,
"ctxt": 0
},
"value": "quux",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 70,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 70,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 74,
"end": 152,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 80,
"end": 152,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 80,
"end": 83,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 102,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 85,
"end": 102,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"value": "Readonly",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 93,
"end": 102,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 94,
"end": 101,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 94,
"end": 101,
"ctxt": 0
},
"value": "ObjType",
"optional": false
},
"typeParams": null
}
]
}
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 105,
"end": 152,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 114,
"end": 119,
"ctxt": 0
},
"value": "bar",
"raw": "'bar'"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 123,
"end": 126,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 128,
"end": 133,
"ctxt": 0
},
"value": "qux",
"raw": "'qux'"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 137,
"end": 141,
"ctxt": 0
},
"value": "quux",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"value": "quuz",
"raw": "'quuz'"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 154,
"end": 182,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 160,
"end": 182,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 160,
"end": 176,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 167,
"end": 174,
"ctxt": 0
},
"rest": {
"start": 167,
"end": 170,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 170,
"end": 174,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "Identifier",
"span": {
"start": 179,
"end": 182,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 184,
"end": 199,
"ctxt": 0
},
"expression": {
"type": "UnaryExpression",
"span": {
"start": 184,
"end": 199,
"ctxt": 0
},
"operator": "delete",
"argument": {
"type": "MemberExpression",
"span": {
"start": 191,
"end": 199,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 191,
"end": 195,
"ctxt": 0
},
"value": "rest",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 196,
"end": 199,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
}
],
"interpreter": null
}