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

1086 lines
24 KiB
JSON

{
"type": "Script",
"span": {
"start": 46,
"end": 532,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 46,
"end": 77,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 58,
"end": 77,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 64,
"end": 75,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 64,
"end": 67,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 67,
"end": 75,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 69,
"end": 75,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 79,
"end": 118,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 91,
"end": 118,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 98,
"end": 107,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 99,
"end": 107,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 101,
"end": 107,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 116,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"kind": "string"
}
},
"readonly": false,
"static": false,
"span": {
"start": 97,
"end": 116,
"ctxt": 0
}
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 120,
"end": 175,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 132,
"end": 175,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 138,
"end": 149,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 138,
"end": 141,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 141,
"end": 149,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 155,
"end": 164,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 156,
"end": 164,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 158,
"end": 164,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 165,
"end": 173,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 167,
"end": 173,
"ctxt": 0
},
"kind": "string"
}
},
"readonly": false,
"static": false,
"span": {
"start": 154,
"end": 173,
"ctxt": 0
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 177,
"end": 196,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 191,
"end": 195,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 197,
"end": 216,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 211,
"end": 215,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 212,
"end": 215,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 214,
"end": 215,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 214,
"end": 215,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 217,
"end": 236,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 231,
"end": 235,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 232,
"end": 235,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 237,
"end": 268,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 251,
"end": 267,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 252,
"end": 267,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 254,
"end": 267,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 254,
"end": 255,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 254,
"end": 255,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 258,
"end": 267,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 289,
"end": 295,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 289,
"end": 294,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 289,
"end": 290,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 291,
"end": 294,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 296,
"end": 304,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 296,
"end": 304,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 296,
"end": 297,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 297,
"end": 304,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 298,
"end": 303,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 332,
"end": 338,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 332,
"end": 337,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 332,
"end": 333,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 334,
"end": 337,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 339,
"end": 348,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 339,
"end": 347,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 339,
"end": 340,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 340,
"end": 347,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 341,
"end": 346,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 369,
"end": 375,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 369,
"end": 374,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 369,
"end": 370,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 371,
"end": 374,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 376,
"end": 384,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 376,
"end": 384,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 376,
"end": 377,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 377,
"end": 384,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 378,
"end": 383,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 412,
"end": 418,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 412,
"end": 417,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 412,
"end": 413,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 414,
"end": 417,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 419,
"end": 428,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 419,
"end": 427,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 419,
"end": 420,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 420,
"end": 427,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 421,
"end": 426,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 458,
"end": 465,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 458,
"end": 464,
"ctxt": 0
},
"questionDotToken": {
"start": 459,
"end": 460,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 458,
"end": 464,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 458,
"end": 459,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 461,
"end": 464,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 466,
"end": 476,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 466,
"end": 476,
"ctxt": 0
},
"questionDotToken": {
"start": 467,
"end": 468,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 466,
"end": 476,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 466,
"end": 467,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 469,
"end": 476,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 470,
"end": 475,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 513,
"end": 520,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 513,
"end": 519,
"ctxt": 0
},
"questionDotToken": {
"start": 514,
"end": 515,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 513,
"end": 519,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 513,
"end": 514,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 516,
"end": 519,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 521,
"end": 532,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 521,
"end": 531,
"ctxt": 0
},
"questionDotToken": {
"start": 522,
"end": 523,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 521,
"end": 531,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 521,
"end": 522,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 524,
"end": 531,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 525,
"end": 530,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
}
}
],
"interpreter": null
}