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

1340 lines
37 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 1054,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1,
"end": 36,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 11,
"end": 15,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 16,
"end": 36,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 22,
"end": 34,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 22,
"end": 25,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 25,
"end": 33,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 27,
"end": 33,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 38,
"end": 89,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 48,
"end": 55,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 64,
"end": 68,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 64,
"end": 68,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 69,
"end": 89,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 75,
"end": 87,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 75,
"end": 78,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 78,
"end": 86,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 80,
"end": 86,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 275,
"end": 628,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 282,
"end": 293,
"ctxt": 0
},
"value": "NotOptional",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 294,
"end": 628,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 300,
"end": 338,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 310,
"end": 311,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 312,
"end": 338,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 322,
"end": 332,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 322,
"end": 325,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 325,
"end": 331,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 327,
"end": 331,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 327,
"end": 331,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 350,
"end": 351,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 344,
"end": 404,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 375,
"end": 389,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 375,
"end": 379,
"ctxt": 0
},
"value": "fooo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 379,
"end": 388,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 381,
"end": 388,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 381,
"end": 388,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
}
},
"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": "TsExpressionWithTypeArguments",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 410,
"end": 447,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 420,
"end": 422,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 423,
"end": 447,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 433,
"end": 441,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 433,
"end": 434,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 434,
"end": 440,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 436,
"end": 440,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 436,
"end": 440,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 459,
"end": 461,
"ctxt": 0
},
"value": "B2",
"optional": false
},
"declare": false,
"span": {
"start": 453,
"end": 512,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 486,
"end": 497,
"ctxt": 0
},
"key": {
"type": "NumericLiteral",
"span": {
"start": 486,
"end": 487,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 487,
"end": 496,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 489,
"end": 496,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 489,
"end": 496,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
}
},
"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": "TsExpressionWithTypeArguments",
"span": {
"start": 473,
"end": 475,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 473,
"end": 475,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 518,
"end": 557,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 528,
"end": 530,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 531,
"end": 557,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 541,
"end": 551,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 541,
"end": 544,
"ctxt": 0
},
"value": "1",
"raw": "'1'"
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 544,
"end": 550,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 546,
"end": 550,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 546,
"end": 550,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 569,
"end": 571,
"ctxt": 0
},
"value": "B3",
"optional": false
},
"declare": false,
"span": {
"start": 563,
"end": 626,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 596,
"end": 611,
"ctxt": 0
},
"key": {
"type": "StringLiteral",
"span": {
"start": 596,
"end": 601,
"ctxt": 0
},
"value": "1.0",
"raw": "'1.0'"
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 601,
"end": 610,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 603,
"end": 610,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 603,
"end": 610,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
}
},
"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": "TsExpressionWithTypeArguments",
"span": {
"start": 583,
"end": 585,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 583,
"end": 585,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"typeArguments": null
}
]
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 671,
"end": 1054,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 678,
"end": 686,
"ctxt": 0
},
"value": "Optional",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 687,
"end": 1054,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 693,
"end": 732,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 703,
"end": 704,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 705,
"end": 732,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 715,
"end": 726,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 715,
"end": 718,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 719,
"end": 725,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 721,
"end": 725,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 721,
"end": 725,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 744,
"end": 745,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 738,
"end": 808,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 769,
"end": 783,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 769,
"end": 773,
"ctxt": 0
},
"value": "fooo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 773,
"end": 782,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 775,
"end": 782,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 775,
"end": 782,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
}
},
"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": "TsExpressionWithTypeArguments",
"span": {
"start": 757,
"end": 758,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 757,
"end": 758,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 814,
"end": 852,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 824,
"end": 826,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 827,
"end": 852,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 837,
"end": 846,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 837,
"end": 838,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 839,
"end": 845,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 841,
"end": 845,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 841,
"end": 845,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 864,
"end": 866,
"ctxt": 0
},
"value": "B2",
"optional": false
},
"declare": false,
"span": {
"start": 858,
"end": 927,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 891,
"end": 902,
"ctxt": 0
},
"key": {
"type": "NumericLiteral",
"span": {
"start": 891,
"end": 892,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 892,
"end": 901,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 894,
"end": 901,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 894,
"end": 901,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
}
},
"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": "TsExpressionWithTypeArguments",
"span": {
"start": 878,
"end": 880,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 878,
"end": 880,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 933,
"end": 973,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 943,
"end": 945,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 946,
"end": 973,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 956,
"end": 967,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 956,
"end": 959,
"ctxt": 0
},
"value": "1",
"raw": "'1'"
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 960,
"end": 966,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 962,
"end": 966,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 962,
"end": 966,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 985,
"end": 987,
"ctxt": 0
},
"value": "B3",
"optional": false
},
"declare": false,
"span": {
"start": 979,
"end": 1052,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 1012,
"end": 1027,
"ctxt": 0
},
"key": {
"type": "StringLiteral",
"span": {
"start": 1012,
"end": 1017,
"ctxt": 0
},
"value": "1.0",
"raw": "'1.0'"
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1017,
"end": 1026,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1019,
"end": 1026,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1019,
"end": 1026,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"typeParams": null
}
},
"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": "TsExpressionWithTypeArguments",
"span": {
"start": 999,
"end": 1001,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 999,
"end": 1001,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"typeArguments": null
}
]
}
]
}
}
],
"interpreter": null
}