Title: 3.5 regression: union type as property accessor break function parameter inference · Issue #32038 · microsoft/TypeScript · GitHub
Open Graph Title: 3.5 regression: union type as property accessor break function parameter inference · Issue #32038 · microsoft/TypeScript
X Title: 3.5 regression: union type as property accessor break function parameter inference · Issue #32038 · microsoft/TypeScript
Description: TypeScript Version: 3.5.2 (it works with 3.4.4). Also tested on 3.6.0-dev.20190622 Search Terms: Code (not real-life, just a repro) const actions = ['resizeTo', 'resizeBy'] as const; for (const action of actions) { window[action] = (x, y...
Open Graph Description: TypeScript Version: 3.5.2 (it works with 3.4.4). Also tested on 3.6.0-dev.20190622 Search Terms: Code (not real-life, just a repro) const actions = ['resizeTo', 'resizeBy'] as const; for (const act...
X Description: TypeScript Version: 3.5.2 (it works with 3.4.4). Also tested on 3.6.0-dev.20190622 Search Terms: Code (not real-life, just a repro) const actions = ['resizeTo', 'resizeBy'] as const...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32038
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"3.5 regression: union type as property accessor break function parameter inference","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.5.2 (it works with 3.4.4). Also tested on 3.6.0-dev.20190622\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\n\r\n**Code** (not real-life, just a repro)\r\n\r\n```ts\r\nconst actions = ['resizeTo', 'resizeBy'] as const;\r\nfor (const action of actions) {\r\n\twindow[action] = (x, y) => {\r\n\t\twindow[action](x, y);\r\n\t}\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\n`x` and `y` are of type `number` (like in 3.4)\r\n\r\n**Actual behavior:**\r\n\r\n`x` and `y` are of type `any`\r\n\r\n**Playground Link:** (enable `noImplicitAny`, but it seems to be on 3.4)\r\n\r\nhttps://www.typescriptlang.org/play/#src=%0D%0Aconst%20actions%20%3D%20%5B'resizeTo'%2C%20'resizeBy'%5D%20as%20const%3B%0D%0Afor%20(const%20action%20of%20actions)%20%7B%0D%0A%09window%5Baction%5D%20%3D%20(x%2C%20y)%20%3D%3E%20%7B%0D%0A%09%09window%5Baction%5D(x%2C%20y)%3B%0D%0A%09%7D%0D%0A%7D\r\n\r\n**Related Issues:** \r\n\r\nhttps://github.com/microsoft/TypeScript/issues/32037","author":{"url":"https://github.com/fregante","@type":"Person","name":"fregante"},"datePublished":"2019-06-22T06:40:47Z","url":"https://github.com/microsoft/TypeScript/issues/32038"}
| 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:8900b44c-eb12-900d-1e5b-3c76a8b15595 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A206:296654:9AC3C7:D11848:6B00EA43 |
| html-safe-nonce | e13fc727a22fddcf54ceee44b8bacd8598157e45dfbf59cb0b34af9590d4287a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjA2OjI5NjY1NDo5QUMzQzc6RDExODQ4OjZCMDBFQTQzIiwidmlzaXRvcl9pZCI6IjE3ODAwNTg0NzQ3NTE3ODE0NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 80a878239027e0fab4dd1fbd2631e7a2d7bc9af6f565fed08c1d22e94e1aa57a |
| hovercard-subject-tag | issue:459444033 |
| 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/32038/issue_layout |
| twitter:image | https://opengraph.githubassets.com/365bf62aaa2fd678e6beb76e07c47f3856381f0d94b2a6e3f52155316d3d561d/microsoft/TypeScript/issues/32038 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/365bf62aaa2fd678e6beb76e07c47f3856381f0d94b2a6e3f52155316d3d561d/microsoft/TypeScript/issues/32038 |
| og:image:alt | TypeScript Version: 3.5.2 (it works with 3.4.4). Also tested on 3.6.0-dev.20190622 Search Terms: Code (not real-life, just a repro) const actions = ['resizeTo', 'resizeBy'] as const; for (const act... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fregante |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width