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

801 lines
24 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 565,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 0,
"end": 63,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 10,
"end": 24,
"ctxt": 0
},
"value": "ContextualType",
"optional": false
},
"declare": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 24,
"end": 27,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 28,
"end": 63,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 34,
"end": 61,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 34,
"end": 40,
"ctxt": 0
},
"value": "method",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 41,
"end": 53,
"ctxt": 0
},
"value": "parameter",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 50,
"end": 53,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 54,
"end": 60,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 56,
"end": 60,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 71,
"end": 76,
"ctxt": 0
},
"value": "CBase",
"optional": false
},
"declare": false,
"span": {
"start": 65,
"end": 177,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 87,
"end": 132,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 87,
"end": 98,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 99,
"end": 123,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 99,
"end": 123,
"ctxt": 0
},
"value": "param",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 104,
"end": 123,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 106,
"end": 123,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 106,
"end": 120,
"ctxt": 0
},
"value": "ContextualType",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 120,
"end": 123,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 125,
"end": 132,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 138,
"end": 175,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 138,
"end": 141,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 142,
"end": 166,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 142,
"end": 166,
"ctxt": 0
},
"value": "param",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 147,
"end": 166,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 149,
"end": 166,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 149,
"end": 163,
"ctxt": 0
},
"value": "ContextualType",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 138,
"end": 175,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 168,
"end": 175,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 76,
"end": 79,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 179,
"end": 565,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 215,
"end": 563,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 215,
"end": 226,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 229,
"end": 563,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 308,
"end": 391,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 308,
"end": 390,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 308,
"end": 313,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 314,
"end": 389,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 328,
"end": 334,
"ctxt": 0
},
"value": "method",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 335,
"end": 336,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 335,
"end": 336,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 328,
"end": 379,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 338,
"end": 379,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 356,
"end": 365,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 356,
"end": 364,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 356,
"end": 357,
"ctxt": 0
},
"value": "p",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 358,
"end": 364,
"ctxt": 0
},
"value": "length",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 470,
"end": 557,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 470,
"end": 556,
"ctxt": 0
},
"callee": {
"type": "SuperPropExpression",
"span": {
"start": 470,
"end": 479,
"ctxt": 0
},
"obj": {
"type": "Super",
"span": {
"start": 470,
"end": 475,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 476,
"end": 479,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 480,
"end": 555,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 494,
"end": 500,
"ctxt": 0
},
"value": "method",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 501,
"end": 502,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 501,
"end": 502,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 494,
"end": 545,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 504,
"end": 545,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 522,
"end": 531,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 522,
"end": 530,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 522,
"end": 523,
"ctxt": 0
},
"value": "p",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 524,
"end": 530,
"ctxt": 0
},
"value": "length",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 195,
"end": 200,
"ctxt": 0
},
"value": "CBase",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 200,
"end": 208,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 201,
"end": 207,
"ctxt": 0
},
"kind": "string"
}
]
},
"implements": []
}
],
"interpreter": null
}