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

1182 lines
29 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
"end": 481,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 6,
"end": 10,
"ctxt": 0
},
"value": "List",
"optional": false
},
"declare": false,
"span": {
"start": 0,
"end": 58,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 21,
"end": 29,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 21,
"end": 25,
"ctxt": 0
},
"value": "data",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 25,
"end": 28,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 27,
"end": 28,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 27,
"end": 28,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 35,
"end": 55,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 35,
"end": 39,
"ctxt": 0
},
"value": "next",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 39,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 41,
"end": 54,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 41,
"end": 45,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 45,
"end": 54,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 46,
"end": 53,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 46,
"end": 50,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 50,
"end": 53,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "T",
"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": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 10,
"end": 13,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 11,
"end": 12,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 11,
"end": 12,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 68,
"end": 79,
"ctxt": 0
},
"value": "DerivedList",
"optional": false
},
"declare": false,
"span": {
"start": 62,
"end": 144,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 106,
"end": 113,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 106,
"end": 109,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 91,
"end": 95,
"ctxt": 0
},
"value": "List",
"optional": false
},
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "U",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 95,
"end": 98,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 96,
"end": 97,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 96,
"end": 97,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
},
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"declare": false,
"span": {
"start": 148,
"end": 212,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 171,
"end": 179,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 171,
"end": 175,
"ctxt": 0
},
"value": "data",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 175,
"end": 178,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 177,
"end": 178,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 177,
"end": 178,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 185,
"end": 209,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 185,
"end": 189,
"ctxt": 0
},
"value": "next",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 189,
"end": 208,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 191,
"end": 208,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 191,
"end": 197,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 197,
"end": 208,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 198,
"end": 207,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 198,
"end": 204,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 204,
"end": 207,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "T",
"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": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 160,
"end": 163,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 216,
"end": 239,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 220,
"end": 238,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 220,
"end": 224,
"ctxt": 0
},
"value": "list",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 224,
"end": 238,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 226,
"end": 238,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 226,
"end": 230,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 230,
"end": 238,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 231,
"end": 237,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 241,
"end": 265,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 245,
"end": 264,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 245,
"end": 250,
"ctxt": 0
},
"value": "list2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 250,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 252,
"end": 264,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 252,
"end": 256,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 256,
"end": 264,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 257,
"end": 263,
"ctxt": 0
},
"kind": "string"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 267,
"end": 294,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 271,
"end": 293,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 271,
"end": 277,
"ctxt": 0
},
"value": "myList",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 277,
"end": 293,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 279,
"end": 293,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 279,
"end": 285,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 285,
"end": 293,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 286,
"end": 292,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 298,
"end": 322,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 302,
"end": 321,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 302,
"end": 304,
"ctxt": 0
},
"value": "xs",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 307,
"end": 321,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 308,
"end": 312,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 314,
"end": 320,
"ctxt": 0
},
"value": "myList",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 332,
"end": 355,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 336,
"end": 354,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 336,
"end": 338,
"ctxt": 0
},
"value": "ys",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 341,
"end": 354,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 342,
"end": 346,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 348,
"end": 353,
"ctxt": 0
},
"value": "list2",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 365,
"end": 387,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 369,
"end": 386,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 369,
"end": 371,
"ctxt": 0
},
"value": "zs",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 374,
"end": 386,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 375,
"end": 379,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NullLiteral",
"span": {
"start": 381,
"end": 385,
"ctxt": 0
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 409,
"end": 448,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 413,
"end": 447,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 413,
"end": 426,
"ctxt": 0
},
"value": "myDerivedList",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 426,
"end": 447,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 428,
"end": 447,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 428,
"end": 439,
"ctxt": 0
},
"value": "DerivedList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 439,
"end": 447,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 440,
"end": 446,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 450,
"end": 481,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 454,
"end": 480,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 454,
"end": 456,
"ctxt": 0
},
"value": "as",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 459,
"end": 480,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 460,
"end": 464,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 466,
"end": 479,
"ctxt": 0
},
"value": "myDerivedList",
"optional": false
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}