swc/crates/swc_ecma_parser/tests/tsc/objectRestReadonly.json
2022-03-22 07:54:08 +00:00

462 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 10,
"end": 198,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 10,
"end": 71,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 15,
"end": 22,
"ctxt": 0
},
"value": "ObjType",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 25,
"end": 71,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 29,
"end": 40,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 29,
"end": 32,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 40,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 34,
"end": 40,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 43,
"end": 54,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 54,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 57,
"end": 69,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 57,
"end": 61,
"ctxt": 0
},
"value": "quux",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 61,
"end": 69,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 73,
"end": 151,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 79,
"end": 151,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 82,
"end": 101,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 84,
"end": 101,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"value": "Readonly",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 92,
"end": 101,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 93,
"end": 100,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 93,
"end": 100,
"ctxt": 0
},
"value": "ObjType",
"optional": false
},
"typeParams": null
}
]
}
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 104,
"end": 151,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 113,
"end": 118,
"ctxt": 0
},
"value": "bar",
"raw": "'bar'"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 122,
"end": 125,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"value": "qux",
"raw": "'qux'"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 136,
"end": 140,
"ctxt": 0
},
"value": "quux",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 142,
"end": 148,
"ctxt": 0
},
"value": "quuz",
"raw": "'quuz'"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 153,
"end": 181,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 159,
"end": 181,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 159,
"end": 175,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 161,
"end": 164,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 161,
"end": 164,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 166,
"end": 173,
"ctxt": 0
},
"rest": {
"start": 166,
"end": 169,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 169,
"end": 173,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "Identifier",
"span": {
"start": 178,
"end": 181,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 183,
"end": 198,
"ctxt": 0
},
"expression": {
"type": "UnaryExpression",
"span": {
"start": 183,
"end": 198,
"ctxt": 0
},
"operator": "delete",
"argument": {
"type": "MemberExpression",
"span": {
"start": 190,
"end": 198,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 190,
"end": 194,
"ctxt": 0
},
"value": "rest",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 195,
"end": 198,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
}
],
"interpreter": null
}