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

639 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 24,
"end": 245,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 24,
"end": 140,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 54,
"end": 85,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 54,
"end": 65,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 66,
"end": 80,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 73,
"end": 80,
"ctxt": 0
},
"value": "data",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 77,
"end": 80,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 82,
"end": 85,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 90,
"end": 138,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 90,
"end": 93,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 90,
"end": 138,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 113,
"end": 138,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 123,
"end": 132,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 93,
"end": 106,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 94,
"end": 105,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 31,
"end": 47,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 32,
"end": 46,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 42,
"end": 46,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 42,
"end": 46,
"ctxt": 0
},
"value": "Date",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 142,
"end": 189,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 152,
"end": 155,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 164,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 164,
"end": 168,
"ctxt": 0
},
"value": "Date",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 169,
"end": 189,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 175,
"end": 187,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 175,
"end": 178,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 178,
"end": 186,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 180,
"end": 186,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 191,
"end": 209,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 195,
"end": 208,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 196,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 198,
"end": 201,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 198,
"end": 201,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "NullLiteral",
"span": {
"start": 204,
"end": 208,
"ctxt": 0
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 210,
"end": 227,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 214,
"end": 226,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 214,
"end": 215,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 218,
"end": 226,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 222,
"end": 223,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 228,
"end": 245,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 232,
"end": 244,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 236,
"end": 244,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 236,
"end": 241,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 238,
"end": 241,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}