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

1480 lines
38 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 24,
"end": 515,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 24,
"end": 64,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 29,
"end": 31,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 34,
"end": 63,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 40,
"end": 51,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 40,
"end": 41,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 41,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 43,
"end": 50,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 43,
"end": 45,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 43,
"end": 45,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 66,
"end": 142,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 71,
"end": 73,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 73,
"end": 94,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 74,
"end": 93,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "K",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 84,
"end": 93,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 84,
"end": 87,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 84,
"end": 87,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"type": "TsLiteralType",
"span": {
"start": 90,
"end": 93,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 90,
"end": 93,
"ctxt": 0
},
"value": "y",
"raw": "\"y\""
}
}
]
},
"default": null
}
]
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 97,
"end": 142,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 103,
"end": 115,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 104,
"end": 114,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 106,
"end": 114,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 106,
"end": 111,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 106,
"end": 108,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "K",
"optional": false
},
"typeParams": null
}
]
}
},
"indexType": {
"type": "TsTypeReference",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"value": "K",
"optional": false
},
"typeParams": null
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 130,
"end": 140,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 131,
"end": 139,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 133,
"end": 139,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 144,
"end": 168,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 156,
"end": 167,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 156,
"end": 158,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 158,
"end": 167,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 160,
"end": 167,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 160,
"end": 162,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 162,
"end": 167,
"ctxt": 0
},
"params": [
{
"type": "TsLiteralType",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 169,
"end": 184,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 173,
"end": 183,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"value": "x2x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 179,
"end": 183,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 179,
"end": 181,
"ctxt": 0
},
"value": "x2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 186,
"end": 234,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 196,
"end": 198,
"ctxt": 0
},
"value": "T3",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 198,
"end": 215,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 199,
"end": 214,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 209,
"end": 214,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 209,
"end": 211,
"ctxt": 0
},
"value": "T3",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 216,
"end": 234,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 222,
"end": 232,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 222,
"end": 223,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 223,
"end": 231,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 225,
"end": 231,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 227,
"end": 230,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 227,
"end": 230,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 236,
"end": 298,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 246,
"end": 248,
"ctxt": 0
},
"value": "T4",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 248,
"end": 265,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 249,
"end": 264,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 259,
"end": 264,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 259,
"end": 261,
"ctxt": 0
},
"value": "T4",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 261,
"end": 264,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 266,
"end": 298,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 272,
"end": 286,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 272,
"end": 273,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 273,
"end": 285,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 275,
"end": 285,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 275,
"end": 280,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 275,
"end": 277,
"ctxt": 0
},
"value": "T4",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 277,
"end": 280,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 278,
"end": 279,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 278,
"end": 279,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 281,
"end": 284,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 281,
"end": 284,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 306,
"end": 308,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"declare": false,
"span": {
"start": 300,
"end": 338,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 315,
"end": 326,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 315,
"end": 316,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 316,
"end": 325,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 318,
"end": 325,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 318,
"end": 320,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 318,
"end": 320,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 321,
"end": 324,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 321,
"end": 324,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 346,
"end": 348,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"declare": false,
"span": {
"start": 340,
"end": 406,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 355,
"end": 368,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 355,
"end": 356,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 356,
"end": 367,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 358,
"end": 367,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsThisType",
"span": {
"start": 358,
"end": 362,
"ctxt": 0
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 363,
"end": 366,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 363,
"end": 366,
"ctxt": 0
},
"value": "y",
"raw": "\"y\""
}
}
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 373,
"end": 386,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 373,
"end": 374,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 374,
"end": 385,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 376,
"end": 385,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsThisType",
"span": {
"start": 376,
"end": 380,
"ctxt": 0
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 381,
"end": 384,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 381,
"end": 384,
"ctxt": 0
},
"value": "z",
"raw": "\"z\""
}
}
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 391,
"end": 404,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 392,
"end": 403,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 394,
"end": 403,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsThisType",
"span": {
"start": 394,
"end": 398,
"ctxt": 0
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 399,
"end": 402,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 399,
"end": 402,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 430,
"end": 467,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 440,
"end": 443,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 444,
"end": 467,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 450,
"end": 465,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 450,
"end": 455,
"ctxt": 0
},
"value": "hello",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 455,
"end": 464,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 457,
"end": 464,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 478,
"end": 481,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 469,
"end": 515,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 512,
"end": 515,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 481,
"end": 509,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 482,
"end": 508,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 482,
"end": 483,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsUnionType",
"span": {
"start": 492,
"end": 508,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 492,
"end": 495,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 492,
"end": 495,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
},
{
"type": "TsIndexedAccessType",
"span": {
"start": 498,
"end": 508,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 500,
"end": 507,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 500,
"end": 507,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
}
}
]
},
"default": null
}
]
},
"returnType": null
}
],
"interpreter": null
}