Title: with infer in template string, suggestion works in 4.6, but not work in 4.7 · Issue #49680 · microsoft/TypeScript · GitHub
Open Graph Title: with infer in template string, suggestion works in 4.6, but not work in 4.7 · Issue #49680 · microsoft/TypeScript
X Title: with infer in template string, suggestion works in 4.6, but not work in 4.7 · Issue #49680 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms suggestion pathof 🕗 Version & Regression Information 4.7 ⏯ Playground Link Playground link with relevant code 💻 Code // get from https://github.com/microsoft/TypeScript/issues/20423#issuecomment-812564842 type P...
Open Graph Description: Bug Report 🔎 Search Terms suggestion pathof 🕗 Version & Regression Information 4.7 ⏯ Playground Link Playground link with relevant code 💻 Code // get from https://github.com/microsoft/TypeScript/is...
X Description: Bug Report 🔎 Search Terms suggestion pathof 🕗 Version & Regression Information 4.7 ⏯ Playground Link Playground link with relevant code 💻 Code // get from https://github.com/microsoft/TypeScrip...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/49680
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"with infer in template string, suggestion works in 4.6, but not work in 4.7","articleBody":"# Bug Report\r\n\r\n\u003c!--\r\n Please fill in each section completely. Thank you!\r\n-->\r\n\r\n### 🔎 Search Terms\r\n\r\nsuggestion pathof\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n4.7\r\n\r\n### ⏯ Playground Link\r\n\r\n\u003c!--\r\n A link to a TypeScript Playground \"Share\" link which shows this behavior\r\n\r\n The TypeScript Workbench can be used for more complex setups, try\r\n https://www.typescriptlang.org/dev/bug-workbench/\r\n\r\n As a last resort, you can link to a repo, but these will be slower for us to investigate.\r\n-->\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ts=4.6.4#code/FAehAIHMFMBdwGYCcD2BbcALWsAOBnALjEgEtZMBXAIwDoBjdENU+1fFBWEAFQE9c0AMptSubqXz5K0fCABMABgAs8gMwBiSdOiM0aaADtYAWgAcARnkBWAGzKzq4LAHRwABQCGFAPIIAPDwANOAA0uDQAB6wRgAm+OD4sEikhpAh7hHRcQlJKWngALzgAEQlAHxFwOBhWTGG8eAABgAkAN6pCNBI4ACqAL607Z3d4ABq-U3VNeAA-H11OeAA1tB8nOA8cx7emH6BANq9ALohYyGtbe797QO0TZWEze3X7avrCJvgAGTgABR5VKQcAAH3AhkoaGo3QAlJNpjUnuEovVGu8Nlt5pdXm1QpNwE9sTc2ujPltfgDkkDQeDIdCkHCmgBuYCs2K6AA2niQbgQlEM9FgpBQhnAjEM0gMSH8yOyDVyVLS5T+uF2Ty8vgCbU8T0BaRC1CebXousVkH6-RCoXKMIJtKh3RZrPFku6fwA5HR3TDgEA)\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well-->\r\n```ts\r\n\r\n// get from https://github.com/microsoft/TypeScript/issues/20423#issuecomment-812564842\r\ntype PathOf\u003cT, K extends string, P extends string = \"\"> =\r\n K extends `${infer U}.${infer V}`\r\n ? U extends keyof T ? PathOf\u003cT[U], V, `${P}${U}.`> : `${P}${keyof T & (string | number)}`\r\n : K extends keyof T ? `${P}${K}` : `${P}${keyof T & (string | number)}`;\r\n\r\n\r\ndeclare function consumer\u003cK extends string>(path: PathOf\u003c{a: string, b: {c: string}}, K>) : number;\r\n\r\n// suggestion works well in 4.6, and not work in 4.7\r\nconsumer('b.')\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n\r\n\r\n\r\n\u003c!-- What happened, and why it was wrong -->\r\n\r\n### 🙂 Expected behavior\r\n\r\n\r\n\r\n\r\n\u003c!-- What you expected to happen instead, and why -->\r\n","author":{"url":"https://github.com/zhijiliao","@type":"Person","name":"zhijiliao"},"datePublished":"2022-06-25T00:55:28Z","url":"https://github.com/microsoft/TypeScript/issues/49680"}
| 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:331de22b-cda8-b087-386f-cc07009ae545 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8210:2E124E:198FC27:209879C:6B014EFB |
| html-safe-nonce | 156b8a0f2e92d2e4f56cee8e3932084b1fce9fd24b6b305732d1d2c20e948683 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjEwOjJFMTI0RToxOThGQzI3OjIwOTg3OUM6NkIwMTRFRkIiLCJ2aXNpdG9yX2lkIjoiNTE4NTA2NDA0MjU2OTQ4NjA3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cd51787e275d3de39bdaa76046935f6c57927e879c1ebcb2da72da12adb33782 |
| hovercard-subject-tag | issue:1284390335 |
| 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/49680/issue_layout |
| twitter:image | https://opengraph.githubassets.com/427f9d447898ce15280b3ac65f491f40defdbc5c6c080aca577a7b28ef307735/microsoft/TypeScript/issues/49680 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/427f9d447898ce15280b3ac65f491f40defdbc5c6c080aca577a7b28ef307735/microsoft/TypeScript/issues/49680 |
| og:image:alt | Bug Report 🔎 Search Terms suggestion pathof 🕗 Version & Regression Information 4.7 ⏯ Playground Link Playground link with relevant code 💻 Code // get from https://github.com/microsoft/TypeScript/is... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zhijiliao |
| 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