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

502 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 25,
"end": 235,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 25,
"end": 74,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "E",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 38,
"end": 45,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": {
"type": "StringLiteral",
"span": {
"start": 42,
"end": 45,
"ctxt": 0
},
"value": "a",
"raw": "\"a\""
}
},
{
"type": "TsEnumMember",
"span": {
"start": 51,
"end": 58,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": {
"type": "StringLiteral",
"span": {
"start": 55,
"end": 58,
"ctxt": 0
},
"value": "b",
"raw": "\"b\""
}
},
{
"type": "TsEnumMember",
"span": {
"start": 64,
"end": 71,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 64,
"end": 65,
"ctxt": 0
},
"value": "C",
"optional": false
},
"init": {
"type": "StringLiteral",
"span": {
"start": 68,
"end": 71,
"ctxt": 0
},
"value": "c",
"raw": "\"c\""
}
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 76,
"end": 140,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 86,
"end": 90,
"ctxt": 0
},
"value": "Item",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 91,
"end": 140,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 97,
"end": 107,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 98,
"end": 106,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 112,
"end": 122,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 113,
"end": 121,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 115,
"end": 121,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 127,
"end": 138,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 130,
"end": 137,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 142,
"end": 167,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 156,
"end": 166,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 156,
"end": 160,
"ctxt": 0
},
"value": "item",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 160,
"end": 166,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 162,
"end": 166,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 162,
"end": 166,
"ctxt": 0
},
"value": "Item",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 168,
"end": 187,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 182,
"end": 186,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 183,
"end": 186,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 188,
"end": 235,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 194,
"end": 234,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"value": "snb",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 197,
"end": 224,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 199,
"end": 224,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 199,
"end": 205,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 208,
"end": 214,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 217,
"end": 224,
"ctxt": 0
},
"kind": "boolean"
}
]
}
}
},
"init": {
"type": "MemberExpression",
"span": {
"start": 227,
"end": 234,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 227,
"end": 231,
"ctxt": 0
},
"value": "item",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 231,
"end": 234,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "e",
"optional": false
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}