• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  "type": "Program",
3  "statements": [
4    {
5      "type": "VariableDeclaration",
6      "declarations": [
7        {
8          "type": "VariableDeclarator",
9          "id": {
10            "type": "Identifier",
11            "name": "a",
12            "typeAnnotation": {
13              "type": "TSTupleType",
14              "elementTypes": [
15                {
16                  "type": "TSNumberKeyword",
17                  "loc": {
18                    "start": {
19                      "line": 17,
20                      "column": 9
21                    },
22                    "end": {
23                      "line": 17,
24                      "column": 16
25                    }
26                  }
27                },
28                {
29                  "type": "TSStringKeyword",
30                  "loc": {
31                    "start": {
32                      "line": 17,
33                      "column": 17
34                    },
35                    "end": {
36                      "line": 17,
37                      "column": 24
38                    }
39                  }
40                }
41              ],
42              "loc": {
43                "start": {
44                  "line": 17,
45                  "column": 8
46                },
47                "end": {
48                  "line": 17,
49                  "column": 24
50                }
51              }
52            },
53            "decorators": [],
54            "loc": {
55              "start": {
56                "line": 17,
57                "column": 5
58              },
59              "end": {
60                "line": 17,
61                "column": 6
62              }
63            }
64          },
65          "init": null,
66          "loc": {
67            "start": {
68              "line": 17,
69              "column": 5
70            },
71            "end": {
72              "line": 17,
73              "column": 6
74            }
75          }
76        }
77      ],
78      "kind": "var",
79      "loc": {
80        "start": {
81          "line": 17,
82          "column": 1
83        },
84        "end": {
85          "line": 17,
86          "column": 25
87        }
88      }
89    },
90    {
91      "type": "FunctionDeclaration",
92      "function": {
93        "type": "ScriptFunction",
94        "id": {
95          "type": "Identifier",
96          "name": "b",
97          "decorators": [],
98          "loc": {
99            "start": {
100              "line": 19,
101              "column": 10
102            },
103            "end": {
104              "line": 19,
105              "column": 11
106            }
107          }
108        },
109        "generator": false,
110        "async": false,
111        "expression": false,
112        "params": [],
113        "returnType": {
114          "type": "TSTupleType",
115          "elementTypes": [
116            {
117              "type": "TSStringKeyword",
118              "loc": {
119                "start": {
120                  "line": 19,
121                  "column": 16
122                },
123                "end": {
124                  "line": 19,
125                  "column": 23
126                }
127              }
128            },
129            {
130              "type": "TSNumberKeyword",
131              "loc": {
132                "start": {
133                  "line": 19,
134                  "column": 24
135                },
136                "end": {
137                  "line": 19,
138                  "column": 31
139                }
140              }
141            }
142          ],
143          "loc": {
144            "start": {
145              "line": 19,
146              "column": 15
147            },
148            "end": {
149              "line": 19,
150              "column": 31
151            }
152          }
153        },
154        "body": {
155          "type": "BlockStatement",
156          "statements": [
157            {
158              "type": "ReturnStatement",
159              "argument": {
160                "type": "ArrayExpression",
161                "elements": [
162                  {
163                    "type": "StringLiteral",
164                    "value": "foo",
165                    "loc": {
166                      "start": {
167                        "line": 20,
168                        "column": 13
169                      },
170                      "end": {
171                        "line": 20,
172                        "column": 18
173                      }
174                    }
175                  },
176                  {
177                    "type": "NumberLiteral",
178                    "value": 5,
179                    "loc": {
180                      "start": {
181                        "line": 20,
182                        "column": 20
183                      },
184                      "end": {
185                        "line": 20,
186                        "column": 21
187                      }
188                    }
189                  }
190                ],
191                "loc": {
192                  "start": {
193                    "line": 20,
194                    "column": 12
195                  },
196                  "end": {
197                    "line": 20,
198                    "column": 22
199                  }
200                }
201              },
202              "loc": {
203                "start": {
204                  "line": 20,
205                  "column": 5
206                },
207                "end": {
208                  "line": 20,
209                  "column": 23
210                }
211              }
212            }
213          ],
214          "loc": {
215            "start": {
216              "line": 19,
217              "column": 32
218            },
219            "end": {
220              "line": 21,
221              "column": 2
222            }
223          }
224        },
225        "loc": {
226          "start": {
227            "line": 19,
228            "column": 1
229          },
230          "end": {
231            "line": 21,
232            "column": 2
233          }
234        }
235      },
236      "loc": {
237        "start": {
238          "line": 19,
239          "column": 1
240        },
241        "end": {
242          "line": 21,
243          "column": 2
244        }
245      }
246    },
247    {
248      "type": "ExpressionStatement",
249      "expression": {
250        "type": "AssignmentExpression",
251        "operator": "=",
252        "left": {
253          "type": "Identifier",
254          "name": "a",
255          "decorators": [],
256          "loc": {
257            "start": {
258              "line": 23,
259              "column": 1
260            },
261            "end": {
262              "line": 23,
263              "column": 2
264            }
265          }
266        },
267        "right": {
268          "type": "CallExpression",
269          "callee": {
270            "type": "Identifier",
271            "name": "b",
272            "decorators": [],
273            "loc": {
274              "start": {
275                "line": 23,
276                "column": 5
277              },
278              "end": {
279                "line": 23,
280                "column": 6
281              }
282            }
283          },
284          "arguments": [],
285          "optional": false,
286          "loc": {
287            "start": {
288              "line": 23,
289              "column": 5
290            },
291            "end": {
292              "line": 23,
293              "column": 8
294            }
295          }
296        },
297        "loc": {
298          "start": {
299            "line": 23,
300            "column": 1
301          },
302          "end": {
303            "line": 23,
304            "column": 8
305          }
306        }
307      },
308      "loc": {
309        "start": {
310          "line": 23,
311          "column": 1
312        },
313        "end": {
314          "line": 23,
315          "column": 9
316        }
317      }
318    }
319  ],
320  "loc": {
321    "start": {
322      "line": 1,
323      "column": 1
324    },
325    "end": {
326      "line": 23,
327      "column": 9
328    }
329  }
330}
331TypeError: Type '[string, number]' is not assignable to type '[number, string]'. [tupleAssignability9.ts:23:1]
332