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

1074 lines
28 KiB
JSON

{
"type": "Script",
"span": {
"start": 306,
"end": 946,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 306,
"end": 328,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 310,
"end": 327,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 310,
"end": 315,
"ctxt": 0
},
"value": "array",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 318,
"end": 327,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 319,
"end": 320,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 322,
"end": 323,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 325,
"end": 326,
"ctxt": 0
},
"value": 3.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 329,
"end": 355,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 333,
"end": 354,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 333,
"end": 339,
"ctxt": 0
},
"value": "array1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 342,
"end": 354,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 343,
"end": 347,
"ctxt": 0
},
"value": true
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 349,
"end": 350,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"value": 3.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 425,
"end": 474,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 429,
"end": 473,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 429,
"end": 432,
"ctxt": 0
},
"value": "tup",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 432,
"end": 458,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 434,
"end": 458,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 435,
"end": 441,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 435,
"end": 441,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 443,
"end": 449,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 443,
"end": 449,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 461,
"end": 473,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 462,
"end": 463,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 465,
"end": 466,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 471,
"end": 472,
"ctxt": 0
},
"value": 4.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 475,
"end": 553,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 479,
"end": 552,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 479,
"end": 483,
"ctxt": 0
},
"value": "tup1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 483,
"end": 530,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 485,
"end": 530,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 486,
"end": 499,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsUnionType",
"span": {
"start": 486,
"end": 499,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 486,
"end": 492,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 493,
"end": 499,
"ctxt": 0
},
"kind": "string"
}
]
}
},
{
"type": "TsTupleElement",
"span": {
"start": 501,
"end": 514,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsUnionType",
"span": {
"start": 501,
"end": 514,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 501,
"end": 507,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 508,
"end": 514,
"ctxt": 0
},
"kind": "string"
}
]
}
},
{
"type": "TsTupleElement",
"span": {
"start": 516,
"end": 529,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsUnionType",
"span": {
"start": 516,
"end": 529,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 516,
"end": 522,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 523,
"end": 529,
"ctxt": 0
},
"kind": "string"
}
]
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 533,
"end": 552,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 534,
"end": 535,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 537,
"end": 538,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 540,
"end": 541,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 543,
"end": 551,
"ctxt": 0
},
"value": "string",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 554,
"end": 611,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 558,
"end": 610,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 558,
"end": 562,
"ctxt": 0
},
"value": "tup2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 562,
"end": 588,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 564,
"end": 588,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 565,
"end": 571,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 565,
"end": 571,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 573,
"end": 579,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 573,
"end": 579,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 581,
"end": 587,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 581,
"end": 587,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 591,
"end": 610,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 592,
"end": 593,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 595,
"end": 596,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 598,
"end": 599,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 601,
"end": 609,
"ctxt": 0
},
"value": "string",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 831,
"end": 861,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 835,
"end": 860,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 835,
"end": 838,
"ctxt": 0
},
"value": "spr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 841,
"end": 860,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 842,
"end": 843,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 845,
"end": 846,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 848,
"end": 849,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": {
"start": 851,
"end": 854,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 854,
"end": 859,
"ctxt": 0
},
"value": "array",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 862,
"end": 891,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 866,
"end": 890,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 866,
"end": 870,
"ctxt": 0
},
"value": "spr1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 873,
"end": 890,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 874,
"end": 875,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 877,
"end": 878,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 880,
"end": 881,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": {
"start": 883,
"end": 886,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 886,
"end": 889,
"ctxt": 0
},
"value": "tup",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 892,
"end": 946,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 896,
"end": 945,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 896,
"end": 900,
"ctxt": 0
},
"value": "spr2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 900,
"end": 925,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 901,
"end": 925,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 902,
"end": 908,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 902,
"end": 908,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 910,
"end": 916,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 910,
"end": 916,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 918,
"end": 924,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 918,
"end": 924,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 928,
"end": 945,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 929,
"end": 930,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 932,
"end": 933,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 935,
"end": 936,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": {
"start": 938,
"end": 941,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 941,
"end": 944,
"ctxt": 0
},
"value": "tup",
"optional": false
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}