Title: Inference of recursive arrow function's return type is any · Issue #58100 · microsoft/TypeScript · GitHub
Open Graph Title: Inference of recursive arrow function's return type is any · Issue #58100 · microsoft/TypeScript
X Title: Inference of recursive arrow function's return type is any · Issue #58100 · microsoft/TypeScript
Description: 🔎 Search Terms recursive function arrow function 🕗 Version & Regression Information This is a crash This changed between versions ______ and _______ This changed in commit or PR _______ This is the behavior in every version I tried, and ...
Open Graph Description: 🔎 Search Terms recursive function arrow function 🕗 Version & Regression Information This is a crash This changed between versions ______ and _______ This changed in commit or PR _______ This is the...
X Description: 🔎 Search Terms recursive function arrow function 🕗 Version & Regression Information This is a crash This changed between versions ______ and _______ This changed in commit or PR _______ This is...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/58100
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inference of recursive arrow function's return type is any","articleBody":"### 🔎 Search Terms\r\n\r\nrecursive function arrow function\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This is a crash\r\n- This changed between versions ______ and _______\r\n- This changed in commit or PR _______\r\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________\r\n- I was unable to test this on prior versions because _______\r\n\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://www.typescriptlang.org/play?ts=5.4.4#code/PTAEGMHsDsGcBdQDNKQFygBQEpQF4A+UAQ2gE8AoKORFSfLXQ0AbwtFAEsksBZY+AAsAdACdSAE0gBbHKCIAGYQFZcbDh1EBTeAFdR0ZKhztQAX1Pa9B0AooWKIZLujh4nGKABGxUTgzQutJeWqIUSC5uHoY+fmqm3HwCIuLQUrK4iirxGqBW+jG+JhwWmjoFtvYUQA\r\n\r\n### 💻 Code\r\n\r\n```ts\r\n// const foo: () => any\r\nconst foo = () => {\r\n if (Math.random() > 0.5) {\r\n return foo()\r\n }\r\n return 0\r\n}\r\n\r\n// function bar(): number\r\nfunction bar() {\r\n if (Math.random() > 0.5) {\r\n return bar()\r\n }\r\n return 0\r\n}\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nconst foo: () => any\r\n'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.\r\n\r\n### 🙂 Expected behavior\r\n\r\nThe inference should be const foo: () => number, even this inference is happened before the arrow function assign to foo\r\n\r\n### Additional information about the issue\r\n\r\n_No response_","author":{"url":"https://github.com/hospotho","@type":"Person","name":"hospotho"},"datePublished":"2024-04-07T12:22:33Z","url":"https://github.com/microsoft/TypeScript/issues/58100"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4c389dbd-45d1-3a56-8f7c-0dadbdd87d4c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8E2:29AEE8:1BC0E8C:24EE119:6B015E9E |
| html-safe-nonce | 904d15a38e0c4fddb288638a59f4f53a450b8c82e855fca7dcfd0224fca39090 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEUyOjI5QUVFODoxQkMwRThDOjI0RUUxMTk6NkIwMTVFOUUiLCJ2aXNpdG9yX2lkIjoiNTY0NDEyNDM1NDkxNzc4NTI0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ead75d5040b54e170dcf39c6ede4ca9928e983b7b7da69f095eb55b5e3e38350 |
| hovercard-subject-tag | issue:2229743631 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/58100/issue_layout |
| twitter:image | https://opengraph.githubassets.com/369dd0cff5ec7241897b8f58b573a4e77c2a37070b8fb6223829ad061441627c/microsoft/TypeScript/issues/58100 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/369dd0cff5ec7241897b8f58b573a4e77c2a37070b8fb6223829ad061441627c/microsoft/TypeScript/issues/58100 |
| og:image:alt | 🔎 Search Terms recursive function arrow function 🕗 Version & Regression Information This is a crash This changed between versions ______ and _______ This changed in commit or PR _______ This is the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hospotho |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width