Title: Missing overload method on union types · Issue #60006 · microsoft/TypeScript · GitHub
Open Graph Title: Missing overload method on union types · Issue #60006 · microsoft/TypeScript
X Title: Missing overload method on union types · Issue #60006 · microsoft/TypeScript
Description: 🔎 Search Terms overlaod union 🕗 Version & Regression Information This changed between versions ______ and _______ This changed in commit or PR _______ This is the behavior in every version I tried, and I reviewed the FAQ for entries abou...
Open Graph Description: 🔎 Search Terms overlaod union 🕗 Version & Regression Information This changed between versions ______ and _______ This changed in commit or PR _______ This is the behavior in every version I tried,...
X Description: 🔎 Search Terms overlaod union 🕗 Version & Regression Information This changed between versions ______ and _______ This changed in commit or PR _______ This is the behavior in every version I tr...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/60006
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Missing overload method on union types","articleBody":"### 🔎 Search Terms\n\noverlaod union\n\n### 🕗 Version & Regression Information\n\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 overload\r\n- ~~I was unable to test this on prior versions because _______~~\r\n\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play/?ts=5.7.0-dev.20240919#code/FAMwrgdgxgLglgewgAgOYCcFgA4CECeAPACoB8AFAIbrqX4BcyAgjXSaQD7IBKAppQBMkAG3wtaRMgBpkAa14NklCPgCUjALKVshZfhni2ZUsgDewZMnS8YYdCmoSAdNYFgovQlp16DrSaSB5FRQUDK8wrwAtrwQMKrIALwm5haWyFBIAM4wcknIMPjYvAggcgpJiYnIAOTg0PBINcgA-Mjk8vhKWe0R0bEwjMQJyUoqquR9MXEJjFMDANqd3eX4pcjEALoA3GmWkbkYWNj5lKFOqDYdqrvpyHBl5ACERzgJ5neWZ1BOWVeyMleJ2qC02Nz2yAAvhCgU5sGAsgALSaRabxW7pay2exKUK7NKQmQQXgAd2Q3l0Kj8EnYFFU4OhwCAA\n\n### 💻 Code\n\n```ts\r\nfunction groupBy\u003cT>(array: Array\u003cT>| ReadonlyArray\u003cT>, key: any): Map\u003cany, Array\u003cT>> {\r\n return array.reduce\u003cMap\u003cany, Array\u003cT>>>((acc, element) => {\r\n\r\n const k = typeof key === 'function' ? (key as (element: T) => any)(element) : element[key as keyof T];\r\n let group = acc.get(k);\r\n if (!group) {\r\n acc.set(k, group = []);\r\n }\r\n group.push(element);\r\n return acc;\r\n\r\n }, new Map\u003cany, Array\u003cT>>());\r\n}\r\n```\r\n\n\n### 🙁 Actual behavior\n\ngetting the errors:\r\n\r\n**Expected 0 type arguments, but got 1.**\r\n\r\n```\r\nType 'T' is not assignable to type 'Map\u003cany, T[]>'.\r\nExpected 0 type arguments, but got 1.\r\nProperty 'get' does not exist on type 'T'.\r\nProperty 'set' does not exist on type 'T'.\r\n```\n\n### 🙂 Expected behavior\n\nAllowing the use of the 3rd overload method `reduce\u003cU>` of `Array` / `ReadonlyArray`\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/wheeOs","@type":"Person","name":"wheeOs"},"datePublished":"2024-09-19T13:11:40Z","url":"https://github.com/microsoft/TypeScript/issues/60006"}
| 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:7059d426-363d-419f-f0e7-238bbb95ff1d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 999E:1148D3:701D01:9128BA:6B00E3EE |
| html-safe-nonce | 8140cb2b70d49b1d45a40dbab99b318a380104470ec36fcd00a95775c70dc903 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTlFOjExNDhEMzo3MDFEMDE6OTEyOEJBOjZCMDBFM0VFIiwidmlzaXRvcl9pZCI6IjQ5MTY0NzU3OTMxMDc5MDM0NzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ddc4006557ec380daddf2e8de97d22838d4101d7ac8930037417b1bee475f5e4 |
| hovercard-subject-tag | issue:2536306726 |
| 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/60006/issue_layout |
| twitter:image | https://opengraph.githubassets.com/321051dffb3a5183966cb61835db7079dbd9b95495ee58903be1cedef7062c86/microsoft/TypeScript/issues/60006 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/321051dffb3a5183966cb61835db7079dbd9b95495ee58903be1cedef7062c86/microsoft/TypeScript/issues/60006 |
| og:image:alt | 🔎 Search Terms overlaod union 🕗 Version & Regression Information This changed between versions ______ and _______ This changed in commit or PR _______ This is the behavior in every version I tried,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wheeOs |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width