René's URL Explorer Experiment


Title: Function parameter type inference doesn't work with keyof of generic type · Issue #25759 · microsoft/TypeScript · GitHub

Open Graph Title: Function parameter type inference doesn't work with keyof of generic type · Issue #25759 · microsoft/TypeScript

X Title: Function parameter type inference doesn't work with keyof of generic type · Issue #25759 · microsoft/TypeScript

Description: TypeScript Version: 3.1.0-dev.201xxxxx Search Terms: function parameter type inference keyof generic Code function foo1(foo: T, bar: {[key in keyof {foo: number}] : (x: T) => number }) { } function foo2(foo: T, bar: {[key in keyof ...

Open Graph Description: TypeScript Version: 3.1.0-dev.201xxxxx Search Terms: function parameter type inference keyof generic Code function foo1(foo: T, bar: {[key in keyof {foo: number}] : (x: T) => number }) { } funct...

X Description: TypeScript Version: 3.1.0-dev.201xxxxx Search Terms: function parameter type inference keyof generic Code function foo1<T>(foo: T, bar: {[key in keyof {foo: number}] : (x: T) => number }) ...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/25759

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Function parameter type inference doesn't work with keyof of generic type","articleBody":"**TypeScript Version:**  3.1.0-dev.201xxxxx\r\n\r\n**Search Terms:**\r\nfunction parameter type inference keyof generic\r\n**Code**\r\n\r\n```ts\r\nfunction foo1\u003cT>(foo: T, bar: {[key in keyof {foo: number}] : (x: T) => number }) {\r\n}\r\n\r\nfunction foo2\u003cT>(foo: T, bar: {[key in keyof T] : (x: T) => number }) {\r\n}\r\n\r\nfoo1({foo: 1}, {foo: x1 => x1.foo + 1})\r\nfoo2({foo: 1}, {foo: x2 => x2.foo + 1})\r\n\r\n```\r\n\r\n**Expected behavior:**\r\n`x2` has type `{foo:number}`\r\n**Actual behavior:**\r\nCompiler error \r\n`TS7006: Parameter 'x2' implicitly has an 'any' type.`\r\n\r\n`x1` has type `{foo:number}` \r\nbut\r\n`x2` has type `any`\r\n\r\n**Playground Link:** \r\n[Playground](http://www.typescriptlang.org/play/#src=function%20foo1%3CT%3E(foo%3A%20T%2C%20qwe%3A%20%7B%5Bkey%20in%20keyof%20%7Bfoo%3A%20number%7D%5D%20%3A%20(x%3A%20T)%20%3D%3E%20number%20%7D)%20%3A%20any%20%7B%0D%0A%20%20return%20%7B%7D%20as%20any%0D%0A%7D%0D%0A%0D%0Afunction%20foo2%3CT%3E(foo%3A%20T%2C%20qwe%3A%20%7B%5Bkey%20in%20keyof%20T%5D%20%3A%20(x%3A%20T)%20%3D%3E%20number%20%7D)%20%3A%20any%20%7B%0D%0A%20%20return%20%7B%7D%20as%20any%0D%0A%7D%0D%0A%0D%0Aconst%20f1%20%3D%20foo1(%7Bfoo%3A%201%7D%2C%20%7Bfoo%3A%20x%20%3D%3E%20x.foo%20%2B%201%7D)%0D%0Aconst%20f2%20%3D%20foo2(%7Bfoo%3A%201%7D%2C%20%7Bfoo%3A%20x%20%3D%3E%20x.foo%20%2B%201%7D)%0D%0A)\r\n","author":{"url":"https://github.com/user471","@type":"Person","name":"user471"},"datePublished":"2018-07-18T10:00:06Z","url":"https://github.com/microsoft/TypeScript/issues/25759"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:410c1e85-be29-0d6e-0b91-39b5902de43b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC626:EA09B:2531C96:3150006:6B019BD3
html-safe-nonce99bd5502033bda8b4cf95cd0afccbc787caf031d1c5206aa8838425359333db3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjI2OkVBMDlCOjI1MzFDOTY6MzE1MDAwNjo2QjAxOUJEMyIsInZpc2l0b3JfaWQiOiI0OTY5OTQ4MDE1Njg0MDY2MjU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac19ab1755b6e9c37060b653b9fa84b050ee67501a66ba7ecfb8633fd46022ddd0
hovercard-subject-tagissue:342259847
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/25759/issue_layout
twitter:imagehttps://opengraph.githubassets.com/54fc6409122a065e6dec89d9e01c944108749c19207785e8fe40275bbf757ded/microsoft/TypeScript/issues/25759
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/54fc6409122a065e6dec89d9e01c944108749c19207785e8fe40275bbf757ded/microsoft/TypeScript/issues/25759
og:image:altTypeScript Version: 3.1.0-dev.201xxxxx Search Terms: function parameter type inference keyof generic Code function foo1(foo: T, bar: {[key in keyof {foo: number}] : (x: T) => number }) { } funct...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameuser471
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/25759#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F25759
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F25759
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/25759
Reloadhttps://github.com/microsoft/TypeScript/issues/25759
Reloadhttps://github.com/microsoft/TypeScript/issues/25759
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/25759
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/25759
Function parameter type inference doesn't work with keyof of generic typehttps://github.com/microsoft/TypeScript/issues/25759#top
https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 3.5.0https://github.com/microsoft/TypeScript/milestone/89
https://github.com/user471
user471https://github.com/user471
on Jul 18, 2018https://github.com/microsoft/TypeScript/issues/25759#issue-342259847
Playgroundhttp://www.typescriptlang.org/play/#src=function%20foo1%3CT%3E(foo%3A%20T%2C%20qwe%3A%20%7B%5Bkey%20in%20keyof%20%7Bfoo%3A%20number%7D%5D%20%3A%20(x%3A%20T)%20%3D%3E%20number%20%7D)%20%3A%20any%20%7B%0D%0A%20%20return%20%7B%7D%20as%20any%0D%0A%7D%0D%0A%0D%0Afunction%20foo2%3CT%3E(foo%3A%20T%2C%20qwe%3A%20%7B%5Bkey%20in%20keyof%20T%5D%20%3A%20(x%3A%20T)%20%3D%3E%20number%20%7D)%20%3A%20any%20%7B%0D%0A%20%20return%20%7B%7D%20as%20any%0D%0A%7D%0D%0A%0D%0Aconst%20f1%20%3D%20foo1(%7Bfoo%3A%201%7D%2C%20%7Bfoo%3A%20x%20%3D%3E%20x.foo%20%2B%201%7D)%0D%0Aconst%20f2%20%3D%20foo2(%7Bfoo%3A%201%7D%2C%20%7Bfoo%3A%20x%20%3D%3E%20x.foo%20%2B%201%7D)%0D%0A
https://github.com/user471
user471https://github.com/user471
on Jul 18, 2018https://github.com/microsoft/TypeScript/issues/25759#issuecomment-405883214
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
on Jul 18, 2018https://github.com/microsoft/TypeScript/issues/25759#event-1740600055
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
Wesley Wigham (weswigham)https://github.com/weswigham
on Jul 18, 2018https://github.com/microsoft/TypeScript/issues/25759#event-1740600139
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 3.1https://github.com/microsoft/TypeScript/milestone/74
on Jul 18, 2018https://github.com/microsoft/TypeScript/issues/25759#event-1740600192
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 3.1https://github.com/microsoft/TypeScript/milestone/74
TypeScript 3.2https://github.com/microsoft/TypeScript/milestone/77
on Sep 24, 2018https://github.com/microsoft/TypeScript/issues/25759#event-1864109152
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
TypeScript 3.2https://github.com/microsoft/TypeScript/milestone/77
TypeScript 3.2.1https://github.com/microsoft/TypeScript/milestone/84
on Nov 13, 2018https://github.com/microsoft/TypeScript/issues/25759#event-1964086650
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
TypeScript 3.2.1https://github.com/microsoft/TypeScript/milestone/84
TypeScript 3.3.0https://github.com/microsoft/TypeScript/milestone/79
on Nov 29, 2018https://github.com/microsoft/TypeScript/issues/25759#event-1994045895
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 3.3https://github.com/microsoft/TypeScript/milestone/79
TypeScript 3.4.0https://github.com/microsoft/TypeScript/milestone/86
on Feb 1, 2019https://github.com/microsoft/TypeScript/issues/25759#event-2113055639
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
Wesley Wigham (weswigham)https://github.com/weswigham
on Mar 13, 2019https://github.com/microsoft/TypeScript/issues/25759#event-2201542433
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 3.4.0https://github.com/microsoft/TypeScript/milestone/86
TypeScript 3.5.0https://github.com/microsoft/TypeScript/milestone/89
on Mar 13, 2019https://github.com/microsoft/TypeScript/issues/25759#event-2201542729
https://github.com/ahejlsberg
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Mar 25, 2019https://github.com/microsoft/TypeScript/issues/25759#issuecomment-476354144
#30568https://github.com/microsoft/TypeScript/pull/30568
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#30568https://github.com/microsoft/TypeScript/pull/30568
on Mar 28, 2019https://github.com/microsoft/TypeScript/issues/25759#event-2237392138
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
on Mar 28, 2019https://github.com/microsoft/TypeScript/issues/25759#event-2237401649
microsofthttps://github.com/microsoft
on Oct 21, 2025https://github.com/microsoft/TypeScript/issues/25759#event-20415740453
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/25759
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/25759
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 3.5.0https://github.com/microsoft/TypeScript/milestone/89
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.