Title: Suggestion: Implied Promise return type in async functions · Issue #7284 · microsoft/TypeScript · GitHub
Open Graph Title: Suggestion: Implied Promise return type in async functions · Issue #7284 · microsoft/TypeScript
X Title: Suggestion: Implied Promise return type in async functions · Issue #7284 · microsoft/TypeScript
Description: Apologies if this has already been brought up, but I wasn't able to find any issues that cover this topic (#5911 seems closest). The Current State Currently, if you want to enforce typing of an async function's resolved value, you must d...
Open Graph Description: Apologies if this has already been brought up, but I wasn't able to find any issues that cover this topic (#5911 seems closest). The Current State Currently, if you want to enforce typing of an asy...
X Description: Apologies if this has already been brought up, but I wasn't able to find any issues that cover this topic (#5911 seems closest). The Current State Currently, if you want to enforce typing of an...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/7284
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Suggestion: Implied Promise return type in async functions","articleBody":"_Apologies if this has already been brought up, but I wasn't able to find any issues that cover this topic (#5911 seems closest)._\n## The Current State\n\nCurrently, if you want to enforce typing of an `async` function's resolved value, you must declare a return type of `:Promise\u003cResolveType>`:\n\n``` es\nasync function makeStuff():Promise\u003cStuff> {}\n```\n\nThis is a bit counterintuitive when it comes to `async` functions, as they generally mask the fact that there's a `Promise` there to begin with. If you are utilizing promises purely via `async`/`await`, you're _never_ going to see the token `Promise` in your code.\n## Proposal\n\nWhen providing the return type of an `async` function, implicitly wrap it in a `Promise\u003cT>` (unless it is an explicit `Promise\u003cT>` type expression?). This seems reasonable now that #6631 is in.\n\n``` es\nasync function makeStuff():Stuff {}\n```\n\nSeems like the least surprising way of declaring an async function\n","author":{"url":"https://github.com/nevir","@type":"Person","name":"nevir"},"datePublished":"2016-02-28T18:53:19Z","url":"https://github.com/microsoft/TypeScript/issues/7284"}
| 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:e7eef3b5-755d-d92e-d488-8d23feca9310 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8408:3F8A67:349257:4791B3:6B00C738 |
| html-safe-nonce | df6725bd2905042e51edb719f2defcbba969b1cca42f3d679695d51ffec703cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDA4OjNGOEE2NzozNDkyNTc6NDc5MUIzOjZCMDBDNzM4IiwidmlzaXRvcl9pZCI6IjU2NjM2Nzg5ODg4MjkxMTYyMTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f87ef218633cb8903ff1e22e08a73782fa085f0554a0278e333c862b152458ac |
| hovercard-subject-tag | issue:137082437 |
| 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/7284/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8329dd03e49c389d89ba7eb40c69ef23f9cf1c5366ed7fff9babaa0427670bdc/microsoft/TypeScript/issues/7284 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8329dd03e49c389d89ba7eb40c69ef23f9cf1c5366ed7fff9babaa0427670bdc/microsoft/TypeScript/issues/7284 |
| og:image:alt | Apologies if this has already been brought up, but I wasn't able to find any issues that cover this topic (#5911 seems closest). The Current State Currently, if you want to enforce typing of an asy... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nevir |
| hostname | github.com |
| expected-hostname | github.com |
| None | 98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4 |
| 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 | ef013399cf0a3c324bea644a685d7c1e0f06b5b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width