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

1030 lines
29 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 64,
"end": 536,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 64,
"end": 95,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 74,
"end": 78,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 79,
"end": 95,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 81,
"end": 93,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 81,
"end": 84,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 86,
"end": 92,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 97,
"end": 144,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 114,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 123,
"end": 127,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 123,
"end": 127,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 128,
"end": 144,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 130,
"end": 142,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 130,
"end": 133,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 133,
"end": 141,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 135,
"end": 141,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 146,
"end": 197,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 156,
"end": 164,
"ctxt": 0
},
"value": "Derived2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 173,
"end": 180,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 173,
"end": 180,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 181,
"end": 197,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 183,
"end": 195,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 183,
"end": 186,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 186,
"end": 194,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 188,
"end": 194,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 201,
"end": 210,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 205,
"end": 209,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 206,
"end": 209,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 212,
"end": 244,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 216,
"end": 244,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 216,
"end": 218,
"ctxt": 0
},
"value": "b1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 218,
"end": 244,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 220,
"end": 244,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 223,
"end": 232,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 224,
"end": 232,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 226,
"end": 232,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 233,
"end": 241,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 235,
"end": 241,
"ctxt": 0
},
"kind": "string"
}
},
"readonly": false,
"static": false,
"span": {
"start": 222,
"end": 242,
"ctxt": 0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 246,
"end": 253,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 246,
"end": 252,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 246,
"end": 247,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 250,
"end": 252,
"ctxt": 0
},
"value": "b1",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 264,
"end": 271,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 264,
"end": 270,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 264,
"end": 266,
"ctxt": 0
},
"value": "b1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 284,
"end": 536,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 291,
"end": 299,
"ctxt": 0
},
"value": "Generics",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 300,
"end": 536,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 307,
"end": 367,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 346,
"end": 355,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 347,
"end": 355,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 349,
"end": 355,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 356,
"end": 359,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 345,
"end": 360,
"ctxt": 0
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 314,
"end": 333,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 315,
"end": 332,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 315,
"end": 316,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 325,
"end": 332,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 325,
"end": 332,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 387,
"end": 390,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 378,
"end": 533,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 412,
"end": 533,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 423,
"end": 435,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 427,
"end": 434,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 427,
"end": 428,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 428,
"end": 434,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 430,
"end": 434,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 430,
"end": 431,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 431,
"end": 434,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 432,
"end": 433,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 432,
"end": 433,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 445,
"end": 476,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 449,
"end": 476,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 449,
"end": 450,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 450,
"end": 476,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 452,
"end": 476,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 455,
"end": 464,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 456,
"end": 464,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 458,
"end": 464,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 465,
"end": 473,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 467,
"end": 473,
"ctxt": 0
},
"kind": "string"
}
},
"readonly": false,
"static": false,
"span": {
"start": 454,
"end": 474,
"ctxt": 0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 486,
"end": 492,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 486,
"end": 491,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 486,
"end": 487,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 490,
"end": 491,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 511,
"end": 517,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 511,
"end": 516,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 511,
"end": 512,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 515,
"end": 516,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 390,
"end": 409,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 391,
"end": 408,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 401,
"end": 408,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 401,
"end": 408,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"returnType": null
}
]
}
}
],
"interpreter": null
}