Title: Wrong keyof behaviour for generic with extends types in 2.9 · Issue #24560 · microsoft/TypeScript · GitHub
Open Graph Title: Wrong keyof behaviour for generic with extends types in 2.9 · Issue #24560 · microsoft/TypeScript
X Title: Wrong keyof behaviour for generic with extends types in 2.9 · Issue #24560 · microsoft/TypeScript
Description: TypeScript Version: 2.9.1, 3.0.0-dev.20180601 Search Terms: keyof 2.9 generics extract extends string number symbol Code type StringKeyof
Open Graph Description: TypeScript Version: 2.9.1, 3.0.0-dev.20180601 Search Terms: keyof 2.9 generics extract extends string number symbol Code type StringKeyof X Description: TypeScript Version: 2.9.1, 3.0.0-dev.20180601 Search Terms: keyof 2.9 generics extract extends string number symbol Code type StringKeyof<T> = Extract<keyof T, string>; type Omit<T, ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/24560
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wrong keyof behaviour for generic with extends types in 2.9","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:** 2.9.1, 3.0.0-dev.20180601\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** keyof 2.9 generics extract extends string number symbol\r\n\r\n**Code**\r\n\r\n```ts\r\ntype StringKeyof\u003cT> = Extract\u003ckeyof T, string>;\r\n\r\ntype Omit\u003cT, K extends StringKeyof\u003cT>> = any;\r\n\r\ntype WithoutFoo = Omit\u003c{ foo: string }, \"foo\">; // ok\r\n\r\ntype WithoutFooGeneric\u003cP extends { foo: string }> = Omit\u003cP, \"foo\">; // Error: Type '\"foo\"' does not satisfy the constraint 'Extract\u003ckeyof P, string>'.\r\n```\r\n\r\n**Expected behavior:**\r\n\r\n`Omit` should pass `\"foo\"` as valid type for keyof because generic type extends a type that has this string key.\r\n\r\n**Actual behavior:**\r\n\r\nError: `Type '\"foo\"' does not satisfy the constraint 'Extract\u003ckeyof P, string>'.`\r\n\r\n**Playground Link:** [Link](https://www.typescriptlang.org/play/index.html#src=type%20StringKeyof%3CT%3E%20%3D%20Extract%3Ckeyof%20T%2C%20string%3E%3B%0D%0A%0D%0Atype%20Omit%3CT%2C%20K%20extends%20StringKeyof%3CT%3E%3E%20%3D%20any%3B%0D%0A%0D%0Atype%20WithoutFoo%20%3D%20Omit%3C%7B%20foo%3A%20string%20%7D%2C%20%22foo%22%3E%3B%0D%0A%0D%0Atype%20WithoutFooGeneric%3CP%20extends%20%7B%20foo%3A%20string%20%7D%3E%20%3D%20Omit%3CP%2C%20%22foo%22%3E%3B%0D%0A%0D%0A)\r\n\r\n","author":{"url":"https://github.com/mctep","@type":"Person","name":"mctep"},"datePublished":"2018-06-01T12:09:21Z","url":"https://github.com/microsoft/TypeScript/issues/24560"}
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:d72525df-7582-f298-1db0-b71acea87847 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id 98E2:882E2:B17C3C:EBF8B6:6B00EA98 html-safe-nonce c27720c522e0fc02f236fb81424fb0e8c37f194fec811589486f5dd1f7965cc6 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OEUyOjg4MkUyOkIxN0MzQzpFQkY4QjY6NkIwMEVBOTgiLCJ2aXNpdG9yX2lkIjoiNTkyMTMzMDQwNDcxOTEyNzE5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 7c297b57f1a21ad82c1d8b4569848980a2a11f420ef046ba3518969c1be29ca1 hovercard-subject-tag issue:328495779 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/24560/issue_layout twitter:image https://opengraph.githubassets.com/3db05f31f5533abaa497661be0e4f7f7f6159c7fb90b856e3022243b22b10447/microsoft/TypeScript/issues/24560 twitter:card summary_large_image og:image https://opengraph.githubassets.com/3db05f31f5533abaa497661be0e4f7f7f6159c7fb90b856e3022243b22b10447/microsoft/TypeScript/issues/24560 og:image:alt TypeScript Version: 2.9.1, 3.0.0-dev.20180601 Search Terms: keyof 2.9 generics extract extends string number symbol Code type StringKeyof og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username mctep 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
URLs of crawlers that visited me.