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

1336 lines
37 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 1053,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 0,
"end": 35,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 10,
"end": 14,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 15,
"end": 35,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 21,
"end": 33,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 21,
"end": 24,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 24,
"end": 32,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 26,
"end": 32,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 37,
"end": 88,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 47,
"end": 54,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 68,
"end": 88,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 74,
"end": 86,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 74,
"end": 77,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 77,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 79,
"end": 85,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 274,
"end": 627,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 281,
"end": 292,
"ctxt": 0
},
"value": "NotOptional",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 293,
"end": 627,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 299,
"end": 337,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 311,
"end": 337,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 321,
"end": 331,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 321,
"end": 324,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 324,
"end": 330,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 326,
"end": 330,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 326,
"end": 330,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 349,
"end": 350,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 343,
"end": 403,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 374,
"end": 388,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 374,
"end": 378,
"ctxt": 0
},
"value": "fooo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 378,
"end": 387,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 380,
"end": 387,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 380,
"end": 387,
"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": 362,
"end": 363,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 362,
"end": 363,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 409,
"end": 446,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 419,
"end": 421,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 422,
"end": 446,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 432,
"end": 440,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 432,
"end": 433,
"ctxt": 0
},
"value": 1.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 433,
"end": 439,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 435,
"end": 439,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 435,
"end": 439,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 458,
"end": 460,
"ctxt": 0
},
"value": "B2",
"optional": false
},
"declare": false,
"span": {
"start": 452,
"end": 511,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 485,
"end": 496,
"ctxt": 0
},
"key": {
"type": "NumericLiteral",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": 2.0
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 486,
"end": 495,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 488,
"end": 495,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 488,
"end": 495,
"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": 472,
"end": 474,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 472,
"end": 474,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 517,
"end": 556,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 527,
"end": 529,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 530,
"end": 556,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 540,
"end": 550,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 540,
"end": 543,
"ctxt": 0
},
"value": "1",
"raw": "'1'"
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 543,
"end": 549,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 545,
"end": 549,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 545,
"end": 549,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 568,
"end": 570,
"ctxt": 0
},
"value": "B3",
"optional": false
},
"declare": false,
"span": {
"start": 562,
"end": 625,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 595,
"end": 610,
"ctxt": 0
},
"key": {
"type": "StringLiteral",
"span": {
"start": 595,
"end": 600,
"ctxt": 0
},
"value": "1.0",
"raw": "'1.0'"
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 600,
"end": 609,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 602,
"end": 609,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 602,
"end": 609,
"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": 582,
"end": 584,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 582,
"end": 584,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"typeArguments": null
}
]
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 670,
"end": 1053,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 677,
"end": 685,
"ctxt": 0
},
"value": "Optional",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 686,
"end": 1053,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 692,
"end": 731,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 702,
"end": 703,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 704,
"end": 731,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 714,
"end": 725,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 714,
"end": 717,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 718,
"end": 724,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 720,
"end": 724,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 720,
"end": 724,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 743,
"end": 744,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 737,
"end": 807,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 768,
"end": 782,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 768,
"end": 772,
"ctxt": 0
},
"value": "fooo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 772,
"end": 781,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 774,
"end": 781,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 774,
"end": 781,
"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": 756,
"end": 757,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 756,
"end": 757,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 813,
"end": 851,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 823,
"end": 825,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 826,
"end": 851,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 836,
"end": 845,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 836,
"end": 837,
"ctxt": 0
},
"value": 1.0
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 838,
"end": 844,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 840,
"end": 844,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 840,
"end": 844,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 863,
"end": 865,
"ctxt": 0
},
"value": "B2",
"optional": false
},
"declare": false,
"span": {
"start": 857,
"end": 926,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 890,
"end": 901,
"ctxt": 0
},
"key": {
"type": "NumericLiteral",
"span": {
"start": 890,
"end": 891,
"ctxt": 0
},
"value": 2.0
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 891,
"end": 900,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 893,
"end": 900,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 893,
"end": 900,
"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": 877,
"end": 879,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 877,
"end": 879,
"ctxt": 0
},
"value": "A2",
"optional": false
},
"typeArguments": null
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 932,
"end": 972,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 942,
"end": 944,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 945,
"end": 972,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 955,
"end": 966,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "StringLiteral",
"span": {
"start": 955,
"end": 958,
"ctxt": 0
},
"value": "1",
"raw": "'1'"
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 959,
"end": 965,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 961,
"end": 965,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 961,
"end": 965,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 984,
"end": 986,
"ctxt": 0
},
"value": "B3",
"optional": false
},
"declare": false,
"span": {
"start": 978,
"end": 1051,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 1011,
"end": 1026,
"ctxt": 0
},
"key": {
"type": "StringLiteral",
"span": {
"start": 1011,
"end": 1016,
"ctxt": 0
},
"value": "1.0",
"raw": "'1.0'"
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1016,
"end": 1025,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1018,
"end": 1025,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1018,
"end": 1025,
"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": 998,
"end": 1000,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 998,
"end": 1000,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"typeArguments": null
}
]
}
]
}
}
],
"interpreter": null
}