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

1090 lines
29 KiB
JSON

{
"type": "Script",
"span": {
"start": 307,
"end": 947,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 307,
"end": 329,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 311,
"end": 328,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 311,
"end": 316,
"ctxt": 0
},
"value": "array",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 319,
"end": 328,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 320,
"end": 321,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 323,
"end": 324,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 326,
"end": 327,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 330,
"end": 356,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 334,
"end": 355,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 334,
"end": 340,
"ctxt": 0
},
"value": "array1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 343,
"end": 355,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 344,
"end": 348,
"ctxt": 0
},
"value": true
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 350,
"end": 351,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 426,
"end": 475,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 430,
"end": 474,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 430,
"end": 433,
"ctxt": 0
},
"value": "tup",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 433,
"end": 459,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 435,
"end": 459,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 436,
"end": 442,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 436,
"end": 442,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 444,
"end": 450,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 444,
"end": 450,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 452,
"end": 458,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 452,
"end": 458,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 462,
"end": 474,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 463,
"end": 464,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 466,
"end": 467,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 469,
"end": 470,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 472,
"end": 473,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 476,
"end": 554,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 480,
"end": 553,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 480,
"end": 484,
"ctxt": 0
},
"value": "tup1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 484,
"end": 531,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 486,
"end": 531,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 487,
"end": 500,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsUnionType",
"span": {
"start": 487,
"end": 500,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 487,
"end": 493,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 494,
"end": 500,
"ctxt": 0
},
"kind": "string"
}
]
}
},
{
"type": "TsTupleElement",
"span": {
"start": 502,
"end": 515,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsUnionType",
"span": {
"start": 502,
"end": 515,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 502,
"end": 508,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 509,
"end": 515,
"ctxt": 0
},
"kind": "string"
}
]
}
},
{
"type": "TsTupleElement",
"span": {
"start": 517,
"end": 530,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsUnionType",
"span": {
"start": 517,
"end": 530,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 517,
"end": 523,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 524,
"end": 530,
"ctxt": 0
},
"kind": "string"
}
]
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 534,
"end": 553,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 535,
"end": 536,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 538,
"end": 539,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 541,
"end": 542,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 544,
"end": 552,
"ctxt": 0
},
"value": "string",
"raw": "\"string\""
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 555,
"end": 612,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 559,
"end": 611,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 559,
"end": 563,
"ctxt": 0
},
"value": "tup2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 563,
"end": 589,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 565,
"end": 589,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 566,
"end": 572,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 566,
"end": 572,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 574,
"end": 580,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 574,
"end": 580,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 582,
"end": 588,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 582,
"end": 588,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 592,
"end": 611,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 593,
"end": 594,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 596,
"end": 597,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 599,
"end": 600,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 602,
"end": 610,
"ctxt": 0
},
"value": "string",
"raw": "\"string\""
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 832,
"end": 862,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 836,
"end": 861,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 836,
"end": 839,
"ctxt": 0
},
"value": "spr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 842,
"end": 861,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 843,
"end": 844,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 846,
"end": 847,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 849,
"end": 850,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": {
"start": 852,
"end": 855,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 855,
"end": 860,
"ctxt": 0
},
"value": "array",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 863,
"end": 892,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 867,
"end": 891,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 867,
"end": 871,
"ctxt": 0
},
"value": "spr1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 874,
"end": 891,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 875,
"end": 876,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 878,
"end": 879,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 881,
"end": 882,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": {
"start": 884,
"end": 887,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 887,
"end": 890,
"ctxt": 0
},
"value": "tup",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 893,
"end": 947,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 897,
"end": 946,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 897,
"end": 901,
"ctxt": 0
},
"value": "spr2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 901,
"end": 926,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 902,
"end": 926,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 903,
"end": 909,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 903,
"end": 909,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 911,
"end": 917,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 911,
"end": 917,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 919,
"end": 925,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 919,
"end": 925,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 929,
"end": 946,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 930,
"end": 931,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 933,
"end": 934,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 936,
"end": 937,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": {
"start": 939,
"end": 942,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 942,
"end": 945,
"ctxt": 0
},
"value": "tup",
"optional": false
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}