You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// const foo: () => anyconstfoo=()=>{if(Math.random()>0.5){returnfoo()}return0}// function bar(): numberfunctionbar(){if(Math.random()>0.5){returnbar()}return0}
🙁 Actual behavior
const foo: () => any
'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.
🙂 Expected behavior
The inference should be const foo: () => number, even this inference is happened before the arrow function assign to foo
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
Duplicate of #53978. Used search terms: recursive any in:title
They mention a pull request (#53995) related to regular function with self tail calls. Maybe I can update the title to "Self tail calls of arrow function were not ignored"?
🔎 Search Terms
recursive function arrow function
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.4.4#code/PTAEGMHsDsGcBdQDNKQFygBQEpQF4A+UAQ2gE8AoKORFSfLXQ0AbwtFAEsksBZY+AAsAdACdSAE0gBbHKCIAGYQFZcbDh1EBTeAFdR0ZKhztQAX1Pa9B0AooWKIZLujh4nGKABGxUTgzQutJeWqIUSC5uHoY+fmqm3HwCIuLQUrK4iirxGqBW+jG+JhwWmjoFtvYUQA
💻 Code
🙁 Actual behavior
const foo: () => any
'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.
🙂 Expected behavior
The inference should be const foo: () => number, even this inference is happened before the arrow function assign to foo
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: