• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  "type": "Program",
3  "statements": [
4    {
5      "type": "FunctionDeclaration",
6      "function": {
7        "type": "ScriptFunction",
8        "id": {
9          "type": "Identifier",
10          "name": "foo",
11          "decorators": [],
12          "loc": {
13            "start": {
14              "line": 17,
15              "column": 10
16            },
17            "end": {
18              "line": 17,
19              "column": 13
20            }
21          }
22        },
23        "generator": false,
24        "async": false,
25        "expression": false,
26        "params": [
27          {
28            "type": "Identifier",
29            "name": "a",
30            "typeAnnotation": {
31              "type": "TSNumberKeyword",
32              "loc": {
33                "start": {
34                  "line": 17,
35                  "column": 17
36                },
37                "end": {
38                  "line": 17,
39                  "column": 23
40                }
41              }
42            },
43            "decorators": [],
44            "loc": {
45              "start": {
46                "line": 17,
47                "column": 14
48              },
49              "end": {
50                "line": 17,
51                "column": 15
52              }
53            }
54          },
55          {
56            "type": "Identifier",
57            "name": "b",
58            "typeAnnotation": {
59              "type": "TSStringKeyword",
60              "loc": {
61                "start": {
62                  "line": 17,
63                  "column": 28
64                },
65                "end": {
66                  "line": 17,
67                  "column": 34
68                }
69              }
70            },
71            "decorators": [],
72            "loc": {
73              "start": {
74                "line": 17,
75                "column": 25
76              },
77              "end": {
78                "line": 17,
79                "column": 26
80              }
81            }
82          }
83        ],
84        "body": {
85          "type": "BlockStatement",
86          "statements": [
87            {
88              "type": "VariableDeclaration",
89              "declarations": [
90                {
91                  "type": "VariableDeclarator",
92                  "id": {
93                    "type": "Identifier",
94                    "name": "a",
95                    "typeAnnotation": {
96                      "type": "TSNumberKeyword",
97                      "loc": {
98                        "start": {
99                          "line": 18,
100                          "column": 12
101                        },
102                        "end": {
103                          "line": 18,
104                          "column": 18
105                        }
106                      }
107                    },
108                    "decorators": [],
109                    "loc": {
110                      "start": {
111                        "line": 18,
112                        "column": 9
113                      },
114                      "end": {
115                        "line": 18,
116                        "column": 10
117                      }
118                    }
119                  },
120                  "init": {
121                    "type": "CallExpression",
122                    "callee": {
123                      "type": "Identifier",
124                      "name": "foo",
125                      "decorators": [],
126                      "loc": {
127                        "start": {
128                          "line": 18,
129                          "column": 21
130                        },
131                        "end": {
132                          "line": 18,
133                          "column": 24
134                        }
135                      }
136                    },
137                    "arguments": [
138                      {
139                        "type": "NumberLiteral",
140                        "value": 1,
141                        "loc": {
142                          "start": {
143                            "line": 18,
144                            "column": 25
145                          },
146                          "end": {
147                            "line": 18,
148                            "column": 26
149                          }
150                        }
151                      },
152                      {
153                        "type": "StringLiteral",
154                        "value": "bar",
155                        "loc": {
156                          "start": {
157                            "line": 18,
158                            "column": 28
159                          },
160                          "end": {
161                            "line": 18,
162                            "column": 33
163                          }
164                        }
165                      }
166                    ],
167                    "optional": false,
168                    "loc": {
169                      "start": {
170                        "line": 18,
171                        "column": 21
172                      },
173                      "end": {
174                        "line": 18,
175                        "column": 34
176                      }
177                    }
178                  },
179                  "loc": {
180                    "start": {
181                      "line": 18,
182                      "column": 9
183                    },
184                    "end": {
185                      "line": 18,
186                      "column": 34
187                    }
188                  }
189                }
190              ],
191              "kind": "var",
192              "loc": {
193                "start": {
194                  "line": 18,
195                  "column": 5
196                },
197                "end": {
198                  "line": 18,
199                  "column": 35
200                }
201              }
202            },
203            {
204              "type": "ReturnStatement",
205              "argument": {
206                "type": "CallExpression",
207                "callee": {
208                  "type": "Identifier",
209                  "name": "foo",
210                  "decorators": [],
211                  "loc": {
212                    "start": {
213                      "line": 19,
214                      "column": 12
215                    },
216                    "end": {
217                      "line": 19,
218                      "column": 15
219                    }
220                  }
221                },
222                "arguments": [
223                  {
224                    "type": "NumberLiteral",
225                    "value": 2,
226                    "loc": {
227                      "start": {
228                        "line": 19,
229                        "column": 16
230                      },
231                      "end": {
232                        "line": 19,
233                        "column": 17
234                      }
235                    }
236                  },
237                  {
238                    "type": "StringLiteral",
239                    "value": "baz",
240                    "loc": {
241                      "start": {
242                        "line": 19,
243                        "column": 19
244                      },
245                      "end": {
246                        "line": 19,
247                        "column": 24
248                      }
249                    }
250                  }
251                ],
252                "optional": false,
253                "loc": {
254                  "start": {
255                    "line": 19,
256                    "column": 12
257                  },
258                  "end": {
259                    "line": 19,
260                    "column": 25
261                  }
262                }
263              },
264              "loc": {
265                "start": {
266                  "line": 19,
267                  "column": 5
268                },
269                "end": {
270                  "line": 19,
271                  "column": 26
272                }
273              }
274            },
275            {
276              "type": "ReturnStatement",
277              "argument": {
278                "type": "NumberLiteral",
279                "value": 12,
280                "loc": {
281                  "start": {
282                    "line": 20,
283                    "column": 12
284                  },
285                  "end": {
286                    "line": 20,
287                    "column": 14
288                  }
289                }
290              },
291              "loc": {
292                "start": {
293                  "line": 20,
294                  "column": 5
295                },
296                "end": {
297                  "line": 20,
298                  "column": 15
299                }
300              }
301            }
302          ],
303          "loc": {
304            "start": {
305              "line": 17,
306              "column": 36
307            },
308            "end": {
309              "line": 21,
310              "column": 2
311            }
312          }
313        },
314        "loc": {
315          "start": {
316            "line": 17,
317            "column": 1
318          },
319          "end": {
320            "line": 21,
321            "column": 2
322          }
323        }
324      },
325      "loc": {
326        "start": {
327          "line": 17,
328          "column": 1
329        },
330        "end": {
331          "line": 21,
332          "column": 2
333        }
334      }
335    },
336    {
337      "type": "VariableDeclaration",
338      "declarations": [
339        {
340          "type": "VariableDeclarator",
341          "id": {
342            "type": "Identifier",
343            "name": "b",
344            "typeAnnotation": {
345              "type": "TSAnyKeyword",
346              "loc": {
347                "start": {
348                  "line": 23,
349                  "column": 8
350                },
351                "end": {
352                  "line": 23,
353                  "column": 11
354                }
355              }
356            },
357            "decorators": [],
358            "loc": {
359              "start": {
360                "line": 23,
361                "column": 5
362              },
363              "end": {
364                "line": 23,
365                "column": 6
366              }
367            }
368          },
369          "init": null,
370          "loc": {
371            "start": {
372              "line": 23,
373              "column": 5
374            },
375            "end": {
376              "line": 23,
377              "column": 6
378            }
379          }
380        }
381      ],
382      "kind": "var",
383      "loc": {
384        "start": {
385          "line": 23,
386          "column": 1
387        },
388        "end": {
389          "line": 23,
390          "column": 12
391        }
392      }
393    },
394    {
395      "type": "VariableDeclaration",
396      "declarations": [
397        {
398          "type": "VariableDeclarator",
399          "id": {
400            "type": "Identifier",
401            "name": "b",
402            "decorators": [],
403            "loc": {
404              "start": {
405                "line": 24,
406                "column": 5
407              },
408              "end": {
409                "line": 24,
410                "column": 6
411              }
412            }
413          },
414          "init": {
415            "type": "CallExpression",
416            "callee": {
417              "type": "Identifier",
418              "name": "foo",
419              "decorators": [],
420              "loc": {
421                "start": {
422                  "line": 24,
423                  "column": 9
424                },
425                "end": {
426                  "line": 24,
427                  "column": 12
428                }
429              }
430            },
431            "arguments": [
432              {
433                "type": "NumberLiteral",
434                "value": 2,
435                "loc": {
436                  "start": {
437                    "line": 24,
438                    "column": 13
439                  },
440                  "end": {
441                    "line": 24,
442                    "column": 14
443                  }
444                }
445              },
446              {
447                "type": "StringLiteral",
448                "value": "bar",
449                "loc": {
450                  "start": {
451                    "line": 24,
452                    "column": 16
453                  },
454                  "end": {
455                    "line": 24,
456                    "column": 21
457                  }
458                }
459              }
460            ],
461            "optional": false,
462            "loc": {
463              "start": {
464                "line": 24,
465                "column": 9
466              },
467              "end": {
468                "line": 24,
469                "column": 22
470              }
471            }
472          },
473          "loc": {
474            "start": {
475              "line": 24,
476              "column": 5
477            },
478            "end": {
479              "line": 24,
480              "column": 22
481            }
482          }
483        }
484      ],
485      "kind": "var",
486      "loc": {
487        "start": {
488          "line": 24,
489          "column": 1
490        },
491        "end": {
492          "line": 24,
493          "column": 23
494        }
495      }
496    }
497  ],
498  "loc": {
499    "start": {
500      "line": 1,
501      "column": 1
502    },
503    "end": {
504      "line": 25,
505      "column": 1
506    }
507  }
508}
509TypeError: foo implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. [recursiveFunction.ts:17:10]
510