Recursive functions are inferred to have return type any
#3336
Labels
By Design
Deprecated - use "Working as Intended" or "Design Limitation" instead
Consider this code:
(same thing on playground)
Here,
fact
is inferred to have type(number, number?) => any
, and consequentlyres
is inferred to have typeany
.This is vaguely reminiscent of cases #1146, #475, and #523, but those deal with some esoteric circumstances, while this here is a textbook case of a tail-recursive algorithm. Should work.
Note: no, it doesn't have to do with optional parameter, I checked.
The text was updated successfully, but these errors were encountered: