• 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": "TSNamedTupleMember",
17                  "elementType": {
18                    "type": "TSTupleType",
19                    "elementTypes": [
20                      {
21                        "type": "TSNamedTupleMember",
22                        "elementType": {
23                          "type": "TSNumberKeyword",
24                          "loc": {
25                            "start": {
26                              "line": 16,
27                              "column": 17
28                            },
29                            "end": {
30                              "line": 16,
31                              "column": 23
32                            }
33                          }
34                        },
35                        "label": {
36                          "type": "Identifier",
37                          "name": "a",
38                          "decorators": [],
39                          "loc": {
40                            "start": {
41                              "line": 16,
42                              "column": 14
43                            },
44                            "end": {
45                              "line": 16,
46                              "column": 15
47                            }
48                          }
49                        },
50                        "loc": {
51                          "start": {
52                            "line": 16,
53                            "column": 14
54                          },
55                          "end": {
56                            "line": 16,
57                            "column": 24
58                          }
59                        }
60                      },
61                      {
62                        "type": "TSNamedTupleMember",
63                        "elementType": {
64                          "type": "TSNumberKeyword",
65                          "loc": {
66                            "start": {
67                              "line": 16,
68                              "column": 29
69                            },
70                            "end": {
71                              "line": 16,
72                              "column": 35
73                            }
74                          }
75                        },
76                        "label": {
77                          "type": "Identifier",
78                          "name": "b",
79                          "decorators": [],
80                          "loc": {
81                            "start": {
82                              "line": 16,
83                              "column": 25
84                            },
85                            "end": {
86                              "line": 16,
87                              "column": 26
88                            }
89                          }
90                        },
91                        "optional": true,
92                        "loc": {
93                          "start": {
94                            "line": 16,
95                            "column": 25
96                          },
97                          "end": {
98                            "line": 16,
99                            "column": 36
100                          }
101                        }
102                      }
103                    ],
104                    "loc": {
105                      "start": {
106                        "line": 16,
107                        "column": 13
108                      },
109                      "end": {
110                        "line": 16,
111                        "column": 36
112                      }
113                    }
114                  },
115                  "label": {
116                    "type": "Identifier",
117                    "name": "a",
118                    "decorators": [],
119                    "loc": {
120                      "start": {
121                        "line": 16,
122                        "column": 9
123                      },
124                      "end": {
125                        "line": 16,
126                        "column": 10
127                      }
128                    }
129                  },
130                  "optional": true,
131                  "loc": {
132                    "start": {
133                      "line": 16,
134                      "column": 9
135                    },
136                    "end": {
137                      "line": 16,
138                      "column": 37
139                    }
140                  }
141                },
142                {
143                  "type": "TSNamedTupleMember",
144                  "elementType": {
145                    "type": "TSTupleType",
146                    "elementTypes": [
147                      {
148                        "type": "TSUnionType",
149                        "types": [
150                          {
151                            "type": "TSNumberKeyword",
152                            "loc": {
153                              "start": {
154                                "line": 16,
155                                "column": 43
156                              },
157                              "end": {
158                                "line": 16,
159                                "column": 49
160                              }
161                            }
162                          },
163                          {
164                            "type": "TSStringKeyword",
165                            "loc": {
166                              "start": {
167                                "line": 16,
168                                "column": 52
169                              },
170                              "end": {
171                                "line": 16,
172                                "column": 58
173                              }
174                            }
175                          }
176                        ],
177                        "loc": {
178                          "start": {
179                            "line": 16,
180                            "column": 43
181                          },
182                          "end": {
183                            "line": 16,
184                            "column": 59
185                          }
186                        }
187                      }
188                    ],
189                    "loc": {
190                      "start": {
191                        "line": 16,
192                        "column": 42
193                      },
194                      "end": {
195                        "line": 16,
196                        "column": 59
197                      }
198                    }
199                  },
200                  "label": {
201                    "type": "Identifier",
202                    "name": "b",
203                    "decorators": [],
204                    "loc": {
205                      "start": {
206                        "line": 16,
207                        "column": 38
208                      },
209                      "end": {
210                        "line": 16,
211                        "column": 39
212                      }
213                    }
214                  },
215                  "optional": true,
216                  "loc": {
217                    "start": {
218                      "line": 16,
219                      "column": 38
220                    },
221                    "end": {
222                      "line": 16,
223                      "column": 60
224                    }
225                  }
226                },
227                {
228                  "type": "TSNamedTupleMember",
229                  "elementType": {
230                    "type": "TSTypeQuery",
231                    "exprName": {
232                      "type": "Identifier",
233                      "name": "b",
234                      "decorators": [],
235                      "loc": {
236                        "start": {
237                          "line": 16,
238                          "column": 72
239                        },
240                        "end": {
241                          "line": 16,
242                          "column": 73
243                        }
244                      }
245                    },
246                    "loc": {
247                      "start": {
248                        "line": 16,
249                        "column": 65
250                      },
251                      "end": {
252                        "line": 16,
253                        "column": 73
254                      }
255                    }
256                  },
257                  "label": {
258                    "type": "Identifier",
259                    "name": "c",
260                    "decorators": [],
261                    "loc": {
262                      "start": {
263                        "line": 16,
264                        "column": 61
265                      },
266                      "end": {
267                        "line": 16,
268                        "column": 62
269                      }
270                    }
271                  },
272                  "optional": true,
273                  "loc": {
274                    "start": {
275                      "line": 16,
276                      "column": 61
277                    },
278                    "end": {
279                      "line": 16,
280                      "column": 74
281                    }
282                  }
283                }
284              ],
285              "loc": {
286                "start": {
287                  "line": 16,
288                  "column": 8
289                },
290                "end": {
291                  "line": 16,
292                  "column": 74
293                }
294              }
295            },
296            "decorators": [],
297            "loc": {
298              "start": {
299                "line": 16,
300                "column": 5
301              },
302              "end": {
303                "line": 16,
304                "column": 6
305              }
306            }
307          },
308          "init": {
309            "type": "ArrayExpression",
310            "elements": [
311              {
312                "type": "ArrayExpression",
313                "elements": [
314                  {
315                    "type": "NumberLiteral",
316                    "value": 2,
317                    "loc": {
318                      "start": {
319                        "line": 16,
320                        "column": 79
321                      },
322                      "end": {
323                        "line": 16,
324                        "column": 80
325                      }
326                    }
327                  }
328                ],
329                "loc": {
330                  "start": {
331                    "line": 16,
332                    "column": 78
333                  },
334                  "end": {
335                    "line": 16,
336                    "column": 81
337                  }
338                }
339              },
340              {
341                "type": "CallExpression",
342                "callee": {
343                  "type": "Identifier",
344                  "name": "func",
345                  "decorators": [],
346                  "loc": {
347                    "start": {
348                      "line": 16,
349                      "column": 83
350                    },
351                    "end": {
352                      "line": 16,
353                      "column": 87
354                    }
355                  }
356                },
357                "arguments": [
358                  {
359                    "type": "NumberLiteral",
360                    "value": 5,
361                    "loc": {
362                      "start": {
363                        "line": 16,
364                        "column": 88
365                      },
366                      "end": {
367                        "line": 16,
368                        "column": 89
369                      }
370                    }
371                  },
372                  {
373                    "type": "StringLiteral",
374                    "value": "foo",
375                    "loc": {
376                      "start": {
377                        "line": 16,
378                        "column": 91
379                      },
380                      "end": {
381                        "line": 16,
382                        "column": 96
383                      }
384                    }
385                  }
386                ],
387                "optional": false,
388                "loc": {
389                  "start": {
390                    "line": 16,
391                    "column": 83
392                  },
393                  "end": {
394                    "line": 16,
395                    "column": 97
396                  }
397                }
398              },
399              {
400                "type": "ArrayExpression",
401                "elements": [
402                  {
403                    "type": "ArrayExpression",
404                    "elements": [
405                      {
406                        "type": "NumberLiteral",
407                        "value": 1,
408                        "loc": {
409                          "start": {
410                            "line": 16,
411                            "column": 101
412                          },
413                          "end": {
414                            "line": 16,
415                            "column": 102
416                          }
417                        }
418                      }
419                    ],
420                    "loc": {
421                      "start": {
422                        "line": 16,
423                        "column": 100
424                      },
425                      "end": {
426                        "line": 16,
427                        "column": 103
428                      }
429                    }
430                  }
431                ],
432                "loc": {
433                  "start": {
434                    "line": 16,
435                    "column": 99
436                  },
437                  "end": {
438                    "line": 16,
439                    "column": 104
440                  }
441                }
442              }
443            ],
444            "loc": {
445              "start": {
446                "line": 16,
447                "column": 77
448              },
449              "end": {
450                "line": 16,
451                "column": 105
452              }
453            }
454          },
455          "loc": {
456            "start": {
457              "line": 16,
458              "column": 5
459            },
460            "end": {
461              "line": 16,
462              "column": 105
463            }
464          }
465        }
466      ],
467      "kind": "var",
468      "loc": {
469        "start": {
470          "line": 16,
471          "column": 1
472        },
473        "end": {
474          "line": 16,
475          "column": 106
476        }
477      }
478    },
479    {
480      "type": "VariableDeclaration",
481      "declarations": [
482        {
483          "type": "VariableDeclarator",
484          "id": {
485            "type": "Identifier",
486            "name": "b",
487            "typeAnnotation": {
488              "type": "TSTupleType",
489              "elementTypes": [
490                {
491                  "type": "TSTupleType",
492                  "elementTypes": [
493                    {
494                      "type": "TSTupleType",
495                      "elementTypes": [
496                        {
497                          "type": "TSNumberKeyword",
498                          "loc": {
499                            "start": {
500                              "line": 17,
501                              "column": 11
502                            },
503                            "end": {
504                              "line": 17,
505                              "column": 18
506                            }
507                          }
508                        }
509                      ],
510                      "loc": {
511                        "start": {
512                          "line": 17,
513                          "column": 10
514                        },
515                        "end": {
516                          "line": 17,
517                          "column": 19
518                        }
519                      }
520                    }
521                  ],
522                  "loc": {
523                    "start": {
524                      "line": 17,
525                      "column": 9
526                    },
527                    "end": {
528                      "line": 17,
529                      "column": 20
530                    }
531                  }
532                }
533              ],
534              "loc": {
535                "start": {
536                  "line": 17,
537                  "column": 8
538                },
539                "end": {
540                  "line": 17,
541                  "column": 20
542                }
543              }
544            },
545            "decorators": [],
546            "loc": {
547              "start": {
548                "line": 17,
549                "column": 5
550              },
551              "end": {
552                "line": 17,
553                "column": 6
554              }
555            }
556          },
557          "init": null,
558          "loc": {
559            "start": {
560              "line": 17,
561              "column": 5
562            },
563            "end": {
564              "line": 17,
565              "column": 6
566            }
567          }
568        }
569      ],
570      "kind": "var",
571      "loc": {
572        "start": {
573          "line": 17,
574          "column": 1
575        },
576        "end": {
577          "line": 17,
578          "column": 21
579        }
580      }
581    },
582    {
583      "type": "FunctionDeclaration",
584      "function": {
585        "type": "ScriptFunction",
586        "id": {
587          "type": "Identifier",
588          "name": "func",
589          "decorators": [],
590          "loc": {
591            "start": {
592              "line": 19,
593              "column": 10
594            },
595            "end": {
596              "line": 19,
597              "column": 14
598            }
599          }
600        },
601        "generator": false,
602        "async": false,
603        "expression": false,
604        "params": [
605          {
606            "type": "Identifier",
607            "name": "c",
608            "typeAnnotation": {
609              "type": "TSNumberKeyword",
610              "loc": {
611                "start": {
612                  "line": 19,
613                  "column": 18
614                },
615                "end": {
616                  "line": 19,
617                  "column": 24
618                }
619              }
620            },
621            "decorators": [],
622            "loc": {
623              "start": {
624                "line": 19,
625                "column": 15
626              },
627              "end": {
628                "line": 19,
629                "column": 16
630              }
631            }
632          },
633          {
634            "type": "Identifier",
635            "name": "d",
636            "typeAnnotation": {
637              "type": "TSStringKeyword",
638              "loc": {
639                "start": {
640                  "line": 19,
641                  "column": 29
642                },
643                "end": {
644                  "line": 19,
645                  "column": 35
646                }
647              }
648            },
649            "decorators": [],
650            "loc": {
651              "start": {
652                "line": 19,
653                "column": 26
654              },
655              "end": {
656                "line": 19,
657                "column": 27
658              }
659            }
660          }
661        ],
662        "returnType": {
663          "type": "TSTupleType",
664          "elementTypes": [
665            {
666              "type": "TSNumberKeyword",
667              "loc": {
668                "start": {
669                  "line": 19,
670                  "column": 39
671                },
672                "end": {
673                  "line": 19,
674                  "column": 46
675                }
676              }
677            }
678          ],
679          "loc": {
680            "start": {
681              "line": 19,
682              "column": 38
683            },
684            "end": {
685              "line": 19,
686              "column": 46
687            }
688          }
689        },
690        "body": {
691          "type": "BlockStatement",
692          "statements": [
693            {
694              "type": "ReturnStatement",
695              "argument": {
696                "type": "ArrayExpression",
697                "elements": [
698                  {
699                    "type": "NumberLiteral",
700                    "value": 1,
701                    "loc": {
702                      "start": {
703                        "line": 20,
704                        "column": 13
705                      },
706                      "end": {
707                        "line": 20,
708                        "column": 14
709                      }
710                    }
711                  }
712                ],
713                "loc": {
714                  "start": {
715                    "line": 20,
716                    "column": 12
717                  },
718                  "end": {
719                    "line": 20,
720                    "column": 15
721                  }
722                }
723              },
724              "loc": {
725                "start": {
726                  "line": 20,
727                  "column": 5
728                },
729                "end": {
730                  "line": 20,
731                  "column": 16
732                }
733              }
734            }
735          ],
736          "loc": {
737            "start": {
738              "line": 19,
739              "column": 47
740            },
741            "end": {
742              "line": 21,
743              "column": 2
744            }
745          }
746        },
747        "loc": {
748          "start": {
749            "line": 19,
750            "column": 1
751          },
752          "end": {
753            "line": 21,
754            "column": 2
755          }
756        }
757      },
758      "loc": {
759        "start": {
760          "line": 19,
761          "column": 1
762        },
763        "end": {
764          "line": 21,
765          "column": 2
766        }
767      }
768    }
769  ],
770  "loc": {
771    "start": {
772      "line": 1,
773      "column": 1
774    },
775    "end": {
776      "line": 21,
777      "column": 2
778    }
779  }
780}
781TypeError: Type 'number' is not assignable to type '[number]'. [tupleAssignability18.ts:16:101]
782