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

1086 lines
24 KiB
JSON

{
"type": "Script",
"span": {
"start": 47,
"end": 533,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 47,
"end": 78,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 57,
"end": 58,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 59,
"end": 78,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 65,
"end": 76,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 65,
"end": 68,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 68,
"end": 76,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 70,
"end": 76,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 80,
"end": 119,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 92,
"end": 119,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 99,
"end": 108,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 100,
"end": 108,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 102,
"end": 108,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 109,
"end": 117,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 111,
"end": 117,
"ctxt": 0
},
"kind": "string"
}
},
"readonly": false,
"static": false,
"span": {
"start": 98,
"end": 117,
"ctxt": 0
}
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 121,
"end": 176,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 133,
"end": 176,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 139,
"end": 150,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 139,
"end": 142,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 142,
"end": 150,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 156,
"end": 165,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 157,
"end": 165,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 159,
"end": 165,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 166,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"kind": "string"
}
},
"readonly": false,
"static": false,
"span": {
"start": 155,
"end": 174,
"ctxt": 0
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 178,
"end": 197,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 192,
"end": 196,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 198,
"end": 217,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 212,
"end": 216,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 218,
"end": 237,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 232,
"end": 236,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 233,
"end": 236,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 238,
"end": 269,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 252,
"end": 268,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 252,
"end": 253,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 253,
"end": 268,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 255,
"end": 268,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 259,
"end": 268,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 290,
"end": 296,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 290,
"end": 295,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 292,
"end": 295,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 297,
"end": 305,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 297,
"end": 305,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 298,
"end": 305,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 299,
"end": 304,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 333,
"end": 339,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 333,
"end": 338,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 335,
"end": 338,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 340,
"end": 349,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 340,
"end": 348,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 340,
"end": 341,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 341,
"end": 348,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 342,
"end": 347,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 370,
"end": 376,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 370,
"end": 375,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 370,
"end": 371,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 372,
"end": 375,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 377,
"end": 385,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 377,
"end": 385,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 377,
"end": 378,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 378,
"end": 385,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 379,
"end": 384,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 413,
"end": 419,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 413,
"end": 418,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 413,
"end": 414,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 415,
"end": 418,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 420,
"end": 429,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 420,
"end": 428,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 420,
"end": 421,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 421,
"end": 428,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 422,
"end": 427,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 459,
"end": 466,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 459,
"end": 465,
"ctxt": 0
},
"questionDotToken": {
"start": 460,
"end": 461,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 459,
"end": 465,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 459,
"end": 460,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 462,
"end": 465,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 467,
"end": 477,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 467,
"end": 477,
"ctxt": 0
},
"questionDotToken": {
"start": 468,
"end": 469,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 467,
"end": 477,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 467,
"end": 468,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 470,
"end": 477,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 471,
"end": 476,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 514,
"end": 521,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 514,
"end": 520,
"ctxt": 0
},
"questionDotToken": {
"start": 515,
"end": 516,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 514,
"end": 520,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 517,
"end": 520,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 522,
"end": 533,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 522,
"end": 532,
"ctxt": 0
},
"questionDotToken": {
"start": 523,
"end": 524,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 522,
"end": 532,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 522,
"end": 523,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 525,
"end": 532,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 526,
"end": 531,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
}
}
],
"interpreter": null
}