René's URL Explorer Experiment


Title: Incorrect inference/autocompletion on generic arrays, when values can be inferred from a defined object. · Issue #41645 · microsoft/TypeScript · GitHub

Open Graph Title: Incorrect inference/autocompletion on generic arrays, when values can be inferred from a defined object. · Issue #41645 · microsoft/TypeScript

X Title: Incorrect inference/autocompletion on generic arrays, when values can be inferred from a defined object. · Issue #41645 · microsoft/TypeScript

Description: TypeScript Version: 4.1.2 Search Terms: Autocompletion, incorrect, values, inference, generic, array, object, keys Summary: When an interface/a type has an object with generic keys, and an array of those keys, the array values cannot be ...

Open Graph Description: TypeScript Version: 4.1.2 Search Terms: Autocompletion, incorrect, values, inference, generic, array, object, keys Summary: When an interface/a type has an object with generic keys, and an array of...

X Description: TypeScript Version: 4.1.2 Search Terms: Autocompletion, incorrect, values, inference, generic, array, object, keys Summary: When an interface/a type has an object with generic keys, and an array of...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect inference/autocompletion on generic arrays, when values can be inferred from a defined object.","articleBody":"**TypeScript Version:**  4.1.2\r\n\r\n**Search Terms:**\r\nAutocompletion, incorrect, values, inference, generic, array, object, keys\r\n\r\n**Summary:**\r\nWhen an interface/a type has an object with generic keys, and an array of those keys, the array values cannot be infered from the object keys.\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface Recipe\u003cINGREDIENTS extends string> {\r\n  quantities: Record\u003cINGREDIENTS, number>\r\n  allergens?: INGREDIENTS[]\r\n}\r\n\r\nfunction createRecipe\u003cINGREDIENTS extends string>(recipe: Recipe\u003cINGREDIENTS>) {}\r\n\r\ncreateRecipe({\r\n  quantities: {\r\n    eggs: 1,\r\n    flour: 2,\r\n  },\r\n  allergens: ['']\r\n})\r\n```\r\n\r\n**Expected behavior:**\r\nHere, when trying to give a value to `allergens`, the autocompletion should show `\"eggs\" | \"flour\"`.\r\n\r\n**Actual behavior:**\r\nThe autocompletion doesn't find anything.\r\n![image](https://user-images.githubusercontent.com/30944236/99950809-6bf03b80-2d7d-11eb-82c4-7636fda728a0.png)\r\n\r\n**Notes:**\r\nThe other way is working: you can fill the array first, then the object keys will autocomplete - but this rarely make sense to write things that way.\r\n\r\n**Failed workarounds:**\r\nThis bug is still present, even when:\r\n- `allergens` is optionnal\r\n- We switch from an interface to a type\r\n- We use `keyof this['quantities']` instead of `INGREDIENTS[]`","author":{"url":"https://github.com/TheMrZZ","@type":"Person","name":"TheMrZZ"},"datePublished":"2020-11-23T10:22:04Z","url":"https://github.com/microsoft/TypeScript/issues/41645"}

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:38217c31-3325-f173-50b6-614929d0616f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id92CA:2270F4:21A2AFC:2CA04D4:6B018490
html-safe-nonceabcebd14d956caff0306b707bc2c8fd751ab4b036183b2c44661a18c7d79521f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkNBOjIyNzBGNDoyMUEyQUZDOjJDQTA0RDQ6NkIwMTg0OTAiLCJ2aXNpdG9yX2lkIjoiODQ4MzQ4NjYzNzI0OTk5ODI0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9ca38d05e0b625c6ad2cb393e9308111eb5240f89c76d181e7d9911c119ebe66
hovercard-subject-tagissue:748669805
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/41645/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6225df5f2f1d1750d4b07fd77f30b0fa2a945ec92aeba21867ce28414efb0271/microsoft/TypeScript/issues/41645
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6225df5f2f1d1750d4b07fd77f30b0fa2a945ec92aeba21867ce28414efb0271/microsoft/TypeScript/issues/41645
og:image:altTypeScript Version: 4.1.2 Search Terms: Autocompletion, incorrect, values, inference, generic, array, object, keys Summary: When an interface/a type has an object with generic keys, and an array of...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameTheMrZZ
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/41645#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F41645
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%2F41645
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/41645
Reloadhttps://github.com/microsoft/TypeScript/issues/41645
Reloadhttps://github.com/microsoft/TypeScript/issues/41645
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/41645
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/41645
Incorrect inference/autocompletion on generic arrays, when values can be inferred from a defined object.https://github.com/microsoft/TypeScript/issues/41645#top
Domain: LS: Completion ListsThe issue relates to showing completion lists in an editorhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20LS%3A%20Completion%20Lists%22
Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Effort%3A%20Moderate%22
Experience EnhancementNoncontroversial enhancementshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experience%20Enhancement%22
Experimentation NeededSomeone needs to try this out to see what happenshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experimentation%20Needed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/TheMrZZ
Florian ERNST (TheMrZZ)https://github.com/TheMrZZ
on Nov 23, 2020https://github.com/microsoft/TypeScript/issues/41645#issue-748669805
https://user-images.githubusercontent.com/30944236/99950809-6bf03b80-2d7d-11eb-82c4-7636fda728a0.png
https://github.com/andrewbranch
Andrew Branch (andrewbranch)https://github.com/andrewbranch
on Nov 25, 2020https://github.com/microsoft/TypeScript/issues/41645#issuecomment-733904700
#36556https://github.com/microsoft/TypeScript/pull/36556
Andrew Branch (andrewbranch)https://github.com/andrewbranch
Domain: LS: Completion ListsThe issue relates to showing completion lists in an editorhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20LS%3A%20Completion%20Lists%22
Experience EnhancementNoncontroversial enhancementshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experience%20Enhancement%22
Experimentation NeededSomeone needs to try this out to see what happenshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experimentation%20Needed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Nov 25, 2020https://github.com/microsoft/TypeScript/issues/41645#event-4039557669
Andrew Branch (andrewbranch)https://github.com/andrewbranch
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Nov 25, 2020https://github.com/microsoft/TypeScript/issues/41645#event-4039558276
Andrew Branch (andrewbranch)https://github.com/andrewbranch
Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Effort%3A%20Moderate%22
help wantedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
on Nov 25, 2020https://github.com/microsoft/TypeScript/issues/41645#event-4039559661
https://github.com/TheMrZZ
Florian ERNST (TheMrZZ)https://github.com/TheMrZZ
on Nov 29, 2020https://github.com/microsoft/TypeScript/issues/41645#issuecomment-735402815
https://github.com/devanshj
Devansh Jethmalani (devanshj)https://github.com/devanshj
on Jun 9, 2021https://github.com/microsoft/TypeScript/issues/41645#issuecomment-857652928
workaroundhttps://www.typescriptlang.org/play#code/JYOwLgpgTgZghgYwgAgEoQcADhAPAZQgBsYA+ZAbwChlkBHAVznGDGAgGcAuNDAeygATXBzBRQAcwA0yEAwC2AI2ikayOESLQJEEBwD8PQiWQQAHpBCCOlekxZtOPUDGjIAisgC+yfcgAUANYQAJ58MB4AlADaALrIPCAQAG7QVF5UVDAMIAhsfCDICFAQcJDomDi4qKYWuta8lXiopKT+JU08qJGUGVTFpeUY2BD+1LSMzGyO3JRqtBASErMAjFLzyDBEfAxQPABM67ReR+qa2rqz0QBE17HpkUA
workaroundhttps://www.typescriptlang.org/play#code/JYOwLgpgTgZghgYwgAgEoQcADhAPASWQgA9IQATAZ2UrClAHMA+ZAbwChlkBHAVznDAwwCJQBcaDAHso5AgBpkIXgFsARtCadkcADa7oDCCEoB+CQDkp+EDGgEmAbQC67AL7swATxzIrNuyhcABUWAF5kR2DnKKJSYyodEC9kU2QABmQJEAgAN2hXdhheEARhKRBkBCgIOEh0TBwCOLJE2noQZgAKGsaICQbsPHwmAEo2D3Zq2vqMIa6OLj4BYWFRCUWuIgYGcWQARnltLhhdKV4oCQAmI643W519Q2M9xwAiN9c3UaA
https://github.com/TheMrZZ
Florian ERNST (TheMrZZ)https://github.com/TheMrZZ
on Jun 9, 2021https://github.com/microsoft/TypeScript/issues/41645#issuecomment-857683469
https://github.com/devanshj
Devansh Jethmalani (devanshj)https://github.com/devanshj
on Jun 9, 2021https://github.com/microsoft/TypeScript/issues/41645#issuecomment-857731950
workaroundhttps://www.typescriptlang.org/play#code/C4TwDgpgBAShDGBLSAeAUFKBlCAbAZgDQZQCKArgIYB2widEAzlALxQAKATgPZgo4FCUAEQBHKrXqImwgHzFMAQVy4InAOYRqzNl1788REZRVrN2uQqgBJViUwAfKAGsIIbvjIS6DRvahOenzKqhpajELU5AC2AEZqsmiyrFAkAN5Q4jQ+0owAXP6YFNlSTFAQAB7AWgAmzHDw3Jw1KIzAnIjU6pEx8ZyJmIODAPywCE0tAMKUbSjWQm0dXfJQUXEJhYN5Y43Nre2d3au9G5hCJqHmjMMFQ5gAcpScPADu6HeDIWbh5VW1zItDgBtAC6myGo2soPBWyggK60I+AygAF80Gh8ORqPA6NxqFB4JwIJRqg1kBAUDBftVqHUduTKbJZAAKIlISDbGAASigaTRaEJxNJCHJzLSJCykl823FQwg6nU+SgAEYrJh8LhuORONsAEwkFFWC7fbTbIHCRjkdRPYRglFc9GgSAcHh8AAqQgA0kIAGIpLE1CD4ToQGrJNie6n-FxuDxQN1QUZuoGekFQbY+tBO6DTWYeqAAVXD8ajtOYBcTJe2BYA3FnwNBHs9uG9FOGSE5EQEoMzFKW6U3XpRYqpK33ttQIAA3NQOxy8qApqCdGPuTyKEHbQctlCKFMg5Jo7NQbcvYejtjw9TdtZ9buxRDqTrAe-cbiqGhAA
#44428https://github.com/microsoft/TypeScript/issues/44428
https://github.com/MulverineX
Mulverine (MulverineX)https://github.com/MulverineX
on Jul 29, 2026https://github.com/microsoft/TypeScript/issues/41645#issuecomment-5123864904
#44428https://github.com/microsoft/TypeScript/issues/44428
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Help Wantedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Help%20Wanted%22
on Nov 10, 2026https://github.com/microsoft/TypeScript/issues/41645#event-35721464534
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/41645
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/41645
Domain: LS: Completion ListsThe issue relates to showing completion lists in an editorhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20LS%3A%20Completion%20Lists%22
Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Effort%3A%20Moderate%22
Experience EnhancementNoncontroversial enhancementshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experience%20Enhancement%22
Experimentation NeededSomeone needs to try this out to see what happenshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experimentation%20Needed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
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.