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

1525 lines
42 KiB
JSON

{
"type": "Script",
"span": {
"start": 65,
"end": 726,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 65,
"end": 109,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 79,
"end": 107,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 79,
"end": 107,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 93,
"end": 107,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 95,
"end": 105,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 102,
"end": 104,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 86,
"end": 92,
"ctxt": 0
},
"kind": "string"
}
}
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 111,
"end": 165,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 135,
"end": 163,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 135,
"end": 138,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 135,
"end": 163,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 149,
"end": 163,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 151,
"end": 161,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 158,
"end": 160,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 140,
"end": 148,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 142,
"end": 148,
"ctxt": 0
},
"kind": "string"
}
}
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 167,
"end": 309,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 184,
"end": 193,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 185,
"end": 193,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 187,
"end": 193,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 183,
"end": 198,
"ctxt": 0
}
},
{
"type": "ClassProperty",
"span": {
"start": 203,
"end": 210,
"ctxt": 0
},
"key": {
"type": "NumericLiteral",
"span": {
"start": 203,
"end": 206,
"ctxt": 0
},
"value": 1.0
},
"value": null,
"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
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 221,
"end": 228,
"ctxt": 0
},
"key": {
"type": "NumericLiteral",
"span": {
"start": 221,
"end": 224,
"ctxt": 0
},
"value": 2.0
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 224,
"end": 227,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 239,
"end": 247,
"ctxt": 0
},
"key": {
"type": "StringLiteral",
"span": {
"start": 239,
"end": 244,
"ctxt": 0
},
"value": "2.5",
"raw": "\"2.5\""
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 244,
"end": 247,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 246,
"end": 247,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 246,
"end": 247,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 258,
"end": 270,
"ctxt": 0
},
"key": {
"type": "NumericLiteral",
"span": {
"start": 258,
"end": 261,
"ctxt": 0
},
"value": 3.0
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 261,
"end": 269,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 263,
"end": 269,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 284,
"end": 298,
"ctxt": 0
},
"key": {
"type": "StringLiteral",
"span": {
"start": 284,
"end": 289,
"ctxt": 0
},
"value": "4.0",
"raw": "\"4.0\""
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 289,
"end": 297,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 291,
"end": 297,
"ctxt": 0
},
"kind": "string"
}
},
"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": 311,
"end": 458,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 321,
"end": 325,
"ctxt": 0
},
"value": "Foo2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 326,
"end": 458,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 333,
"end": 342,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 334,
"end": 342,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 336,
"end": 342,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 343,
"end": 346,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 345,
"end": 346,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 345,
"end": 346,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 332,
"end": 347,
"ctxt": 0
}
},
{
"type": "TsPropertySignature",
"span": {
"start": 352,
"end": 359,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 352,
"end": 355,
"ctxt": 0
},
"value": 1.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 355,
"end": 358,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 357,
"end": 358,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 357,
"end": 358,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 370,
"end": 377,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 370,
"end": 373,
"ctxt": 0
},
"value": 2.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 373,
"end": 376,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 375,
"end": 376,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 375,
"end": 376,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 388,
"end": 396,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 388,
"end": 393,
"ctxt": 0
},
"value": "2.5",
"raw": "\"2.5\""
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 393,
"end": 396,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 407,
"end": 419,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 407,
"end": 410,
"ctxt": 0
},
"value": 3.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 410,
"end": 418,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 412,
"end": 418,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 433,
"end": 447,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 433,
"end": 438,
"ctxt": 0
},
"value": "4.0",
"raw": "\"4.0\""
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 438,
"end": 446,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 440,
"end": 446,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 460,
"end": 600,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 464,
"end": 599,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 465,
"end": 599,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 467,
"end": 599,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 474,
"end": 483,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 475,
"end": 483,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 477,
"end": 483,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 484,
"end": 487,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 486,
"end": 487,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 486,
"end": 487,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 473,
"end": 488,
"ctxt": 0
}
},
{
"type": "TsPropertySignature",
"span": {
"start": 493,
"end": 500,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 493,
"end": 496,
"ctxt": 0
},
"value": 1.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 496,
"end": 499,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 511,
"end": 518,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 511,
"end": 514,
"ctxt": 0
},
"value": 2.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 514,
"end": 517,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 516,
"end": 517,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 516,
"end": 517,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 529,
"end": 537,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 529,
"end": 534,
"ctxt": 0
},
"value": "2.5",
"raw": "\"2.5\""
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 534,
"end": 537,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 536,
"end": 537,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 536,
"end": 537,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 548,
"end": 560,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 548,
"end": 551,
"ctxt": 0
},
"value": 3.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 551,
"end": 559,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 553,
"end": 559,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 574,
"end": 588,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 574,
"end": 579,
"ctxt": 0
},
"value": "4.0",
"raw": "\"4.0\""
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 579,
"end": 587,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 581,
"end": 587,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 611,
"end": 726,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 615,
"end": 726,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 615,
"end": 616,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 616,
"end": 636,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 618,
"end": 636,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 621,
"end": 630,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 622,
"end": 630,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 624,
"end": 630,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 631,
"end": 634,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 633,
"end": 634,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 633,
"end": 634,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 620,
"end": 634,
"ctxt": 0
}
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 639,
"end": 726,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 645,
"end": 648,
"ctxt": 0
},
"value": 1.0
},
"value": {
"type": "NewExpression",
"span": {
"start": 650,
"end": 657,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 654,
"end": 655,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 664,
"end": 667,
"ctxt": 0
},
"value": 2.0
},
"value": {
"type": "NewExpression",
"span": {
"start": 669,
"end": 676,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 673,
"end": 674,
"ctxt": 0
},
"value": "B",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "StringLiteral",
"span": {
"start": 683,
"end": 688,
"ctxt": 0
},
"value": "2.5",
"raw": "\"2.5\""
},
"value": {
"type": "NewExpression",
"span": {
"start": 690,
"end": 697,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 694,
"end": 695,
"ctxt": 0
},
"value": "B",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 703,
"end": 706,
"ctxt": 0
},
"value": 3.0
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 708,
"end": 709,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "StringLiteral",
"span": {
"start": 715,
"end": 720,
"ctxt": 0
},
"value": "4.0",
"raw": "\"4.0\""
},
"value": {
"type": "StringLiteral",
"span": {
"start": 722,
"end": 724,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}