Title: autocompletion failing in 3.7.1-rc · Issue #34825 · microsoft/TypeScript · GitHub
Open Graph Title: autocompletion failing in 3.7.1-rc · Issue #34825 · microsoft/TypeScript
X Title: autocompletion failing in 3.7.1-rc · Issue #34825 · microsoft/TypeScript
Description: TypeScript Version: 3.7.1-rc Search Terms: Code export type GeMethodsForType
Open Graph Description: TypeScript Version: 3.7.1-rc Search Terms: Code export type GeMethodsForType
X Description: TypeScript Version: 3.7.1-rc Search Terms: Code export type GeMethodsForType<T, G extends string> = { [K in keyof T]: T[K] extends () => any ? { name: K, group: G, } : T[K] extends (s: inf...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/34825
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"autocompletion failing in 3.7.1-rc","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!--\r\nPlease try to reproduce the issue with the latest published version. It may have already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n-->\r\n**TypeScript Version:** 3.7.1-rc\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**\r\n\r\n```ts\r\n\r\nexport type GeMethodsForType\u003cT, G extends string> = { [K in keyof T]:\r\n T[K] extends () => any ? { name: K, group: G, } : T[K] extends (s: infer U) => any ? { name: K, group: G, payload: U } : never }[keyof T];\r\n\r\n\r\nclass Sample {\r\n count = 0;\r\n books: { name: string, year: number }[] = []\r\n increment() {\r\n this.count++\r\n this.count++\r\n }\r\n\r\n addBook(book: Sample[\"books\"][0]) {\r\n this.books.push(book)\r\n }\r\n}\r\nexport declare function testIt\u003cT, G extends string>(): (input: any, method: GeMethodsForType\u003cT, G>) => any\r\n\r\n\r\nconst t = testIt\u003cSample, \"Sample\">()\r\n\r\nconst i = t(null, { name: \"addBook\", group: \"Sample\", payload: { } }) // auto completion for payload\r\n\r\n```\r\n\r\n**Expected behavior:**\r\nPropeties of payload should come in autocompletion\r\n**Actual behavior:**\r\nNo autocompletion\r\n**Playground Link:** [play ground nightly](https://www.typescriptlang.org/play/index.html?ts=Nightly#code/LAKApgHgDg9gTgFwAQIJ5TEg4mAsmBACxgBMBnAMXgBV0wAeagGmyUgTADtykyE4AlpwDmAPiQBeJAG8kAbQDSSIUgDWYVDABmSagF0AXKCQndivWwgduZJAAoAlJPEBDTqiQB+GUk4uAtmAGSAoswnAwAK5QwVgsAL5IwdTmltY8dmTBQlpgcEgAqk4Sru5ePn6BwaFI4VEx2CxQLqgANjAuJMEFSInBnGAAbnm9cuqaOvoA3KCzIADGrS5ktgDKAVCtmNLGpvNRnMhSAAwzIKZIAEYwMKpZFQFBvPxCwiyoYC5w-ZH+lyPxOQWKRA3YmITzOBgQKHRwyMEXFCEARkAB0+0ihwA1FiERciCj0QcEDiEfE5hdOiQAEI3VR2a63YLrfybMByABEjLuHL0cmOeicO3OiJMBLR3LRUEiZEIDLpDjJoHJ4Gg8GQJDAiy+mC0mPmCAEME4KDAfAAkghGCwsGkuDw+IIRKJHME7EJpQhgm5UCxAkRSLE8ARiOQqHBaBhrdhRMVSqg5qB9pw+ChJKaLVaWWyWBzs1sOS7FSAk8bUwJ0wg7JxIq1WixZJUnhyqbTbhywhFosE8xsC00Wu1OsFZIl4sWgA)\r\n\r\n\r\nWorking fine in 3.7 beta and 3.6.x\r\n\r\n[play ground 3.7 beta](https://www.typescriptlang.org/play/index.html?ts=3.7-Beta#code/LAKApgHgDg9gTgFwAQIJ5TEg4mAsmBACxgBMBnAMXgBV0wAeagGmyUgTADtykyE4AlpwDmAPiQBeJAG8kAbQDSSIUgDWYVDABmSagF0AXKCQndivWwgduZJAAoAlJPEBDTqiQB+GUk4uAtmAGSAoswnAwAK5QwVgsAL5IwdTmltY8dmTBQlpgcEgAqk4Sru5ePn6BwaFI4VEx2CxQLqgANjAuJMEFSInBnGAAbnm9cuqaOvoA3KCzIADGrS5ktgDKAVCtmNLGpvNRnMhSAAwzIKZIAEYwMKpZFQFBvPxCwiyoYC5w-ZH+lyPxOQWKRA3YmITzOBgQKHRwyMEXFCEARkAB0+0ihwA1FiERciCj0QcEDiEfE5hdOiQAEI3VR2a63YLrfybMByABEjLuHL0cmOeicO3OiJMBLR3LRUEiZEIDLpDjJoHJ4Gg8GQJDAiy+mC0mPmCAEME4KDAfAAkghGCwsGkuDw+IIRKJHME7EJpQhgm5UCxAkRSLE8ARiOQqHBaBhrdhRMVSqg5qB9pw+ChJKaLVaWWyWBzs1sOS7FSAk8bUwJ0wg7JxIq1WixZJUnhyqbTbhywhFosE8xsC00Wu1OsFZIl4sWgA)\r\n\r\nLooks like its getting confused when some properties doesn't contain `payload` property in this case `increment` method , if i change GeMethodsForType to \r\n\r\n```ts\r\nexport type GeMethodsForType\u003cT, G extends string> = { [K in keyof T]:\r\n T[K] extends () => any ? { name: K, group: G, payload?:undefined} : T[K] extends (s: infer U) => any ? { name: K, group: G, payload: U } : never }[keyof T]; // payload added empty arg methods\r\n```\r\nnow autocompletion working fine in 3.7.1-rc :s ","author":{"url":"https://github.com/chandu0101","@type":"Person","name":"chandu0101"},"datePublished":"2019-10-30T07:58:14Z","url":"https://github.com/microsoft/TypeScript/issues/34825"}
| 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:5af1ee63-2ed2-ded6-7a85-5cda90cc6f93 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D152:2AAD2E:1E3A875:284CC65:6B017444 |
| html-safe-nonce | 38ede0f99f21064abeaa66d716de2c0a0abb97618a4745968122f4246092c703 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTUyOjJBQUQyRToxRTNBODc1OjI4NENDNjU6NkIwMTc0NDQiLCJ2aXNpdG9yX2lkIjoiNDU0NTE2Njc2MDc0MzEwNTYwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e98d9943016506b23b7278b51715f64ff54650667c3ab07f709e4912cd05c31e |
| hovercard-subject-tag | issue:514465746 |
| 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/34825/issue_layout |
| twitter:image | https://opengraph.githubassets.com/80985f87dd1beef7e12756eaa5ed06808f55e7b9892aba21fd55f1d0aff4232d/microsoft/TypeScript/issues/34825 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/80985f87dd1beef7e12756eaa5ed06808f55e7b9892aba21fd55f1d0aff4232d/microsoft/TypeScript/issues/34825 |
| og:image:alt | TypeScript Version: 3.7.1-rc Search Terms: Code export type GeMethodsForType |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chandu0101 |
| 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