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

666 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 212,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 10,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 104,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 17,
"end": 27,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 17,
"end": 18,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 18,
"end": 26,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 20,
"end": 26,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 32,
"end": 39,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 32,
"end": 39,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 36,
"end": 39,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 44,
"end": 77,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"value": "Z",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 44,
"end": 77,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 52,
"end": 77,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 62,
"end": 71,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 83,
"end": 92,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 86,
"end": 92,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 93,
"end": 101,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 95,
"end": 101,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 95,
"end": 101,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 82,
"end": 102,
"ctxt": 0
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 106,
"end": 133,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 116,
"end": 117,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 130,
"end": 133,
"ctxt": 0
},
"body": []
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 135,
"end": 144,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 139,
"end": 143,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 140,
"end": 143,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 145,
"end": 158,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 149,
"end": 157,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 149,
"end": 151,
"ctxt": 0
},
"value": "r1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 154,
"end": 157,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "i",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 156,
"end": 157,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 159,
"end": 174,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 163,
"end": 173,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 163,
"end": 165,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 168,
"end": 173,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 168,
"end": 171,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "i",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 175,
"end": 188,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 179,
"end": 187,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 179,
"end": 181,
"ctxt": 0
},
"value": "r3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 184,
"end": 187,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 184,
"end": 185,
"ctxt": 0
},
"value": "i",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "Z",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 190,
"end": 205,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 194,
"end": 204,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 195,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 197,
"end": 200,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 197,
"end": 200,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 203,
"end": 204,
"ctxt": 0
},
"value": "i",
"optional": false
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 206,
"end": 212,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 206,
"end": 211,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 206,
"end": 207,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": "f",
"optional": false
}
}
}
],
"interpreter": null
}