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

1472 lines
38 KiB
JSON

{
"type": "Script",
"span": {
"start": 23,
"end": 514,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 23,
"end": 63,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 28,
"end": 30,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 33,
"end": 62,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 39,
"end": 50,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 39,
"end": 40,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 40,
"end": 49,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 42,
"end": 49,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 42,
"end": 44,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 42,
"end": 44,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 65,
"end": 141,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 70,
"end": 72,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 72,
"end": 93,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 73,
"end": 92,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "K",
"optional": false
},
"constraint": {
"type": "TsUnionType",
"span": {
"start": 83,
"end": 92,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 83,
"end": 86,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 83,
"end": 86,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"type": "TsLiteralType",
"span": {
"start": 89,
"end": 92,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 89,
"end": 92,
"ctxt": 0
},
"value": "y",
"raw": "\"y\""
}
}
]
},
"default": null
}
]
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 96,
"end": 141,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 102,
"end": 114,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 103,
"end": 113,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 105,
"end": 113,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 105,
"end": 110,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 105,
"end": 107,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 107,
"end": 110,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "K",
"optional": false
},
"typeParams": null
}
]
}
},
"indexType": {
"type": "TsTypeReference",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"value": "K",
"optional": false
},
"typeParams": null
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 129,
"end": 139,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 130,
"end": 138,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 132,
"end": 138,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 143,
"end": 167,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 155,
"end": 166,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 157,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 157,
"end": 166,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 159,
"end": 166,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 159,
"end": 161,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 161,
"end": 166,
"ctxt": 0
},
"params": [
{
"type": "TsLiteralType",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 168,
"end": 183,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 172,
"end": 182,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 172,
"end": 175,
"ctxt": 0
},
"value": "x2x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 178,
"end": 182,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 178,
"end": 180,
"ctxt": 0
},
"value": "x2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 185,
"end": 233,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 195,
"end": 197,
"ctxt": 0
},
"value": "T3",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 197,
"end": 214,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 198,
"end": 213,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 208,
"end": 213,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 208,
"end": 210,
"ctxt": 0
},
"value": "T3",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 210,
"end": 213,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 215,
"end": 233,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 221,
"end": 231,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 222,
"end": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 224,
"end": 230,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 226,
"end": 229,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 226,
"end": 229,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 235,
"end": 297,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 245,
"end": 247,
"ctxt": 0
},
"value": "T4",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 247,
"end": 264,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 248,
"end": 263,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 248,
"end": 249,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 258,
"end": 263,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 258,
"end": 260,
"ctxt": 0
},
"value": "T4",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 260,
"end": 263,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
},
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 265,
"end": 297,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 271,
"end": 285,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 271,
"end": 272,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 272,
"end": 284,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 274,
"end": 284,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 274,
"end": 279,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 274,
"end": 276,
"ctxt": 0
},
"value": "T4",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 276,
"end": 279,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 280,
"end": 283,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 280,
"end": 283,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
}
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 305,
"end": 307,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"declare": false,
"span": {
"start": 299,
"end": 337,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 314,
"end": 325,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 314,
"end": 315,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 315,
"end": 324,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 317,
"end": 324,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 317,
"end": 319,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 317,
"end": 319,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 320,
"end": 323,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 320,
"end": 323,
"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": 345,
"end": 347,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"declare": false,
"span": {
"start": 339,
"end": 405,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 354,
"end": 367,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 354,
"end": 355,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 355,
"end": 366,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 357,
"end": 366,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsThisType",
"span": {
"start": 357,
"end": 361,
"ctxt": 0
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 362,
"end": 365,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 362,
"end": 365,
"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": 372,
"end": 385,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 372,
"end": 373,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 373,
"end": 384,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 375,
"end": 384,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsThisType",
"span": {
"start": 375,
"end": 379,
"ctxt": 0
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 380,
"end": 383,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 380,
"end": 383,
"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": 390,
"end": 403,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 391,
"end": 402,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsIndexedAccessType",
"span": {
"start": 393,
"end": 402,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsThisType",
"span": {
"start": 393,
"end": 397,
"ctxt": 0
}
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 398,
"end": 401,
"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": 429,
"end": 466,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 439,
"end": 442,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 443,
"end": 466,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 449,
"end": 464,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 449,
"end": 454,
"ctxt": 0
},
"value": "hello",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 454,
"end": 463,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 456,
"end": 463,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 477,
"end": 480,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 468,
"end": 514,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 511,
"end": 514,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 480,
"end": 508,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 481,
"end": 507,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsUnionType",
"span": {
"start": 491,
"end": 507,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 491,
"end": 494,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 491,
"end": 494,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
},
{
"type": "TsIndexedAccessType",
"span": {
"start": 497,
"end": 507,
"ctxt": 0
},
"readonly": false,
"objectType": {
"type": "TsTypeReference",
"span": {
"start": 497,
"end": 498,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 497,
"end": 498,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"indexType": {
"type": "TsLiteralType",
"span": {
"start": 499,
"end": 506,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 499,
"end": 506,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
}
}
]
},
"default": null
}
]
},
"returnType": null
}
],
"interpreter": null
}