Title: Wrong tuple inference of async IIFE return value · Issue #44992 · microsoft/TypeScript · GitHub
Open Graph Title: Wrong tuple inference of async IIFE return value · Issue #44992 · microsoft/TypeScript
X Title: Wrong tuple inference of async IIFE return value · Issue #44992 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms tuple, array, promise, async, function, inference 🕗 Version & Regression Information v4.3.5 ⏯ Playground Link Playground link with relevant code 💻 Code and behavior // ❌ Type '(string | number)[]' is not assigna...
Open Graph Description: Bug Report 🔎 Search Terms tuple, array, promise, async, function, inference 🕗 Version & Regression Information v4.3.5 ⏯ Playground Link Playground link with relevant code 💻 Code and behavior // ❌ T...
X Description: Bug Report 🔎 Search Terms tuple, array, promise, async, function, inference 🕗 Version & Regression Information v4.3.5 ⏯ Playground Link Playground link with relevant code 💻 Code and behavior //...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/44992
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wrong tuple inference of async IIFE return value","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n\r\ntuple, array, promise, async, function, inference\r\n\r\n### 🕗 Version & Regression Information\r\n\r\nv4.3.5\r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ssl=3&ssc=9&pln=3&pc=15#code/BQQwzgngdgxgBMAlHAvAPjgbwFBzgenzkBlyXOGAeyjABc4oKB3CgJwGsAuOABRYoFsAlmACmAHgDaVEVygBXfgCMRLADRwazLrRaCoAcwC6GFAnDR4SVBhx48LETTksocCQEZ1Ack0UvhgG4yAF9EJCCyQjhAUHIySmo6CBEwZnYuXgFhcSkoGXoFZTUNLTgdPSMTehFGHj4hUWAyPGAHMAoAGwA3EWR0OFaO7uAPb19-RFUyRCDQ8OwgA)\r\n\r\n### 💻 Code and behavior\r\n\r\n```ts\r\n// ❌ Type '(string | number)[]' is not assignable to type '[one: number, two: string]'.\r\nconst nowork: Promise\u003c[one: number, two: string]> = (async () => {\r\n return [1, 'two'];\r\n})();\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\nAs with supplying an instance of Promise, correctly infer returned value as assignable to the variable.\r\n\r\n```ts\r\n// ✅\r\nconst yeswork: Promise\u003c[one: number, two: string]> = new Promise(\r\n (resolve) => resolve([1, 'two']),\r\n);\r\n```","author":{"url":"https://github.com/enisdenjo","@type":"Person","name":"enisdenjo"},"datePublished":"2021-07-12T21:23:43Z","url":"https://github.com/microsoft/TypeScript/issues/44992"}
| 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:a9d6def6-87e7-7ebd-bc35-d339df871c0e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B66A:2A5566:C0A949:FD247E:6B01C103 |
| html-safe-nonce | 4785b739d924d98e04638340357ddbf487019d61a880fecc306de28c9b212151 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjZBOjJBNTU2NjpDMEE5NDk6RkQyNDdFOjZCMDFDMTAzIiwidmlzaXRvcl9pZCI6IjI5Mjk2NDU0ODcwMDkxNTMyODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4e73abd9716c733845376d1615444aa065101d95c500eecf89f153e40667cf5c |
| hovercard-subject-tag | issue:942461222 |
| 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/44992/issue_layout |
| twitter:image | https://opengraph.githubassets.com/944a9d335fdc644a707ea1e8419b13ec15f89f13efdb9479725bd8e2bfc19e9c/microsoft/TypeScript/issues/44992 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/944a9d335fdc644a707ea1e8419b13ec15f89f13efdb9479725bd8e2bfc19e9c/microsoft/TypeScript/issues/44992 |
| og:image:alt | Bug Report 🔎 Search Terms tuple, array, promise, async, function, inference 🕗 Version & Regression Information v4.3.5 ⏯ Playground Link Playground link with relevant code 💻 Code and behavior // ❌ T... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | enisdenjo |
| 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