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

495 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 208,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 0,
"end": 43,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 10,
"end": 15,
"ctxt": 0
},
"value": "Flags",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 16,
"end": 43,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 19,
"end": 31,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 23,
"end": 31,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 25,
"end": 31,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 41,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 34,
"end": 41,
"ctxt": 0
},
"kind": "boolean"
}
},
"readonly": false,
"static": false,
"span": {
"start": 18,
"end": 41,
"ctxt": 0
}
}
]
}
},
{
"type": "EmptyStatement",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 45,
"end": 62,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 49,
"end": 61,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 49,
"end": 54,
"ctxt": 0
},
"value": "flags",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 54,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"value": "Flags",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 63,
"end": 71,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 63,
"end": 70,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 63,
"end": 68,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 72,
"end": 80,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 72,
"end": 79,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 72,
"end": 77,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "f",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 81,
"end": 114,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 81,
"end": 113,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 81,
"end": 86,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 87,
"end": 113,
"ctxt": 0
},
"value": "isNotNecessarilyNeverFalse",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 115,
"end": 137,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 115,
"end": 136,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 115,
"end": 120,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 120,
"end": 136,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 121,
"end": 135,
"ctxt": 0
},
"value": "this is fine",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 139,
"end": 158,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 149,
"end": 154,
"ctxt": 0
},
"value": "Empty",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 155,
"end": 158,
"ctxt": 0
},
"body": []
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 159,
"end": 176,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 163,
"end": 175,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 163,
"end": 168,
"ctxt": 0
},
"value": "empty",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 168,
"end": 175,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 170,
"end": 175,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 170,
"end": 175,
"ctxt": 0
},
"value": "Empty",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 177,
"end": 188,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 177,
"end": 187,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 177,
"end": 182,
"ctxt": 0
},
"value": "empty",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 183,
"end": 187,
"ctxt": 0
},
"value": "nope",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 189,
"end": 208,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 189,
"end": 207,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 189,
"end": 194,
"ctxt": 0
},
"value": "empty",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 194,
"end": 207,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 195,
"end": 206,
"ctxt": 0
},
"value": "that's ok",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
}
],
"interpreter": null
}