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

1188 lines
30 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 457,
"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": 55,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 20,
"end": 28,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 20,
"end": 24,
"ctxt": 0
},
"value": "data",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 24,
"end": 27,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 26,
"end": 27,
"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": 33,
"end": 53,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 33,
"end": 37,
"ctxt": 0
},
"value": "next",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 39,
"end": 52,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 39,
"end": 43,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 44,
"end": 51,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 44,
"end": 48,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 48,
"end": 51,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"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
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 63,
"end": 74,
"ctxt": 0
},
"value": "DerivedList",
"optional": false
},
"declare": false,
"span": {
"start": 57,
"end": 136,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 100,
"end": 107,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 100,
"end": 103,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 105,
"end": 106,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 105,
"end": 106,
"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": 86,
"end": 90,
"ctxt": 0
},
"value": "List",
"optional": false
},
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 74,
"end": 77,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 90,
"end": 93,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
]
},
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"declare": false,
"span": {
"start": 138,
"end": 199,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 160,
"end": 168,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 160,
"end": 164,
"ctxt": 0
},
"value": "data",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 164,
"end": 167,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 166,
"end": 167,
"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": 173,
"end": 197,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 173,
"end": 177,
"ctxt": 0
},
"value": "next",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 177,
"end": 196,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 179,
"end": 196,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 179,
"end": 185,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 185,
"end": 196,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 186,
"end": 195,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 186,
"end": 192,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 193,
"end": 194,
"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": 150,
"end": 153,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 201,
"end": 224,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 205,
"end": 223,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 205,
"end": 209,
"ctxt": 0
},
"value": "list",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 209,
"end": 223,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 211,
"end": 223,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 211,
"end": 215,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 215,
"end": 223,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 216,
"end": 222,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 225,
"end": 249,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 229,
"end": 248,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 229,
"end": 234,
"ctxt": 0
},
"value": "list2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 234,
"end": 248,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 236,
"end": 248,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 236,
"end": 240,
"ctxt": 0
},
"value": "List",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 240,
"end": 248,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 241,
"end": 247,
"ctxt": 0
},
"kind": "string"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 250,
"end": 277,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 254,
"end": 276,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 254,
"end": 260,
"ctxt": 0
},
"value": "myList",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 260,
"end": 276,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 262,
"end": 276,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 262,
"end": 268,
"ctxt": 0
},
"value": "MyList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 268,
"end": 276,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 269,
"end": 275,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 279,
"end": 303,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 283,
"end": 302,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 283,
"end": 285,
"ctxt": 0
},
"value": "xs",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 288,
"end": 302,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 289,
"end": 293,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 295,
"end": 301,
"ctxt": 0
},
"value": "myList",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 312,
"end": 335,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 316,
"end": 334,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 318,
"ctxt": 0
},
"value": "ys",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 321,
"end": 334,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 322,
"end": 326,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 328,
"end": 333,
"ctxt": 0
},
"value": "list2",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 344,
"end": 366,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 348,
"end": 365,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 348,
"end": 350,
"ctxt": 0
},
"value": "zs",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 353,
"end": 365,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 354,
"end": 358,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NullLiteral",
"span": {
"start": 360,
"end": 364,
"ctxt": 0
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 386,
"end": 425,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 390,
"end": 424,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 390,
"end": 403,
"ctxt": 0
},
"value": "myDerivedList",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 403,
"end": 424,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 405,
"end": 424,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 405,
"end": 416,
"ctxt": 0
},
"value": "DerivedList",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 416,
"end": 424,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 417,
"end": 423,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 426,
"end": 457,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 430,
"end": 456,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 430,
"end": 432,
"ctxt": 0
},
"value": "as",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 435,
"end": 456,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 436,
"end": 440,
"ctxt": 0
},
"value": "list",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 442,
"end": 455,
"ctxt": 0
},
"value": "myDerivedList",
"optional": false
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}