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

487 lines
10 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 209,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1,
"end": 44,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 11,
"end": 16,
"ctxt": 0
},
"value": "Flags",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 17,
"end": 44,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 20,
"end": 32,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 24,
"end": 32,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 26,
"end": 32,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 42,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 42,
"ctxt": 0
},
"kind": "boolean"
}
},
"readonly": false,
"static": false,
"span": {
"start": 19,
"end": 42,
"ctxt": 0
}
}
]
}
},
{
"type": "EmptyStatement",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 46,
"end": 63,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 50,
"end": 62,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 50,
"end": 55,
"ctxt": 0
},
"value": "flags",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 55,
"end": 62,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 57,
"end": 62,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 57,
"end": 62,
"ctxt": 0
},
"value": "Flags",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 64,
"end": 72,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 64,
"end": 71,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 73,
"end": 81,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 73,
"end": 80,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 73,
"end": 78,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"value": "f",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 82,
"end": 115,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 82,
"end": 114,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 82,
"end": 87,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 88,
"end": 114,
"ctxt": 0
},
"value": "isNotNecessarilyNeverFalse",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 116,
"end": 138,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 116,
"end": 137,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 116,
"end": 121,
"ctxt": 0
},
"value": "flags",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 121,
"end": 137,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 122,
"end": 136,
"ctxt": 0
},
"value": "this is fine",
"raw": "'this is fine'"
}
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 140,
"end": 159,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 150,
"end": 155,
"ctxt": 0
},
"value": "Empty",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 156,
"end": 159,
"ctxt": 0
},
"body": []
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 160,
"end": 177,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 164,
"end": 176,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 164,
"end": 169,
"ctxt": 0
},
"value": "empty",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 169,
"end": 176,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 171,
"end": 176,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 171,
"end": 176,
"ctxt": 0
},
"value": "Empty",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 178,
"end": 189,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 178,
"end": 188,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 178,
"end": 183,
"ctxt": 0
},
"value": "empty",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 184,
"end": 188,
"ctxt": 0
},
"value": "nope",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 190,
"end": 209,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 190,
"end": 208,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 190,
"end": 195,
"ctxt": 0
},
"value": "empty",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 195,
"end": 208,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 196,
"end": 207,
"ctxt": 0
},
"value": "that's ok",
"raw": "\"that's ok\""
}
}
}
}
],
"interpreter": null
}