René's URL Explorer Experiment


Title: Using 'Key in keyof ArrayType' always returns an Array regardles of the value manipulation applied · Issue #40069 · microsoft/TypeScript · GitHub

Open Graph Title: Using 'Key in keyof ArrayType' always returns an Array regardles of the value manipulation applied · Issue #40069 · microsoft/TypeScript

X Title: Using 'Key in keyof ArrayType' always returns an Array regardles of the value manipulation applied · Issue #40069 · microsoft/TypeScript

Description: TypeScript Version: 4.0.0-beta (same behaviour in version 3.5.1 v3.5.1-Play Ground) Search Terms: "key in keyof Array", "keyof Array" Expected behavior: using key in ArrayType has the same behaviour as on any object (returning an array t...

Open Graph Description: TypeScript Version: 4.0.0-beta (same behaviour in version 3.5.1 v3.5.1-Play Ground) Search Terms: "key in keyof Array", "keyof Array" Expected behavior: using key in ArrayType has the same behaviou...

X Description: TypeScript Version: 4.0.0-beta (same behaviour in version 3.5.1 v3.5.1-Play Ground) Search Terms: "key in keyof Array", "keyof Array" Expected behavior: using key in ArrayType h...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Using 'Key in keyof ArrayType' always returns an Array regardles of the value manipulation applied","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--\u003e\r\n\r\n**TypeScript Version:**  4.0.0-beta (same behaviour in version 3.5.1 [v3.5.1-Play Ground](https://www.typescriptlang.org/play?strictPropertyInitialization=false\u0026useDefineForClassFields=true\u0026allowUnusedLabels=true\u0026noEmitHelpers=true\u0026noUnusedLocals=true\u0026noUnusedParameters=true\u0026esModuleInterop=false\u0026preserveConstEnums=true\u0026declaration=false\u0026target=99\u0026jsx=0\u0026ts=3.5.1#))\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) --\u003e\r\n**Search Terms:**\r\n\"key in keyof Array\", \"keyof Array\"\r\n\r\n**Expected behavior:**\r\nusing ```key in ArrayType``` has the same behaviour as on any object *(returning an array type only if the relevant properties are unchanged)*\r\n\r\n**Actual behavior:**\r\nusing ```key in ArrayType``` performs actions on touple entries but the returned type allways includes all default Array properties\r\n\r\n***Extention note:***\r\nNot the point of this issue and i know there are other issues around this topic. it's just a note,\r\nbut how about possibly adding tupple functionality for ArrayLike-, Map- and Set-types? They have all the basic qualities of a tupple, and it would be awesome to use them in a similar fashion (especially inference of ```Map.prototype.get/set``` and ```[Symbol.iterator]``` inference of tupples)\r\n\r\n\u003c!-- Did you find other bugs that looked similar? --\u003e\r\n**Related Issues:**\r\n#39726 \r\n#34780\r\n[type-fest/issues/119](https://github.com/sindresorhus/type-fest/issues/119) *(external library, but about this this behaviour and includes adHoc fix)*\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\r\ntype Arr2 = (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)[]\r\ntype WhoopMyArray_Faulty\u003cBase extends ArrayLike\u003cany\u003e, Condition\u003e = {  \r\n\t\t[Key in keyof Base]:\r\n\t\t\tBase[Key] extends Condition\r\n\t\t\t\t? 'Whoop it'\r\n\t\t\t\t: Base[Key] extends Base[number] ? Base[Key] : never\r\n\t}\r\n\r\n// action is performed on array elements but return type is still a proper array\r\ntype WhoopedArray = WhoopMyArray_Faulty\u003cArr, 7 | 5 | 2\u003e\r\ntype WhoopedArrayKeys = WhoopMyArray_Faulty\u003cArr, 7 | 5 | 2\u003e[keyof Arr]\r\n\r\n// related side note, but not the main pont\r\n// no action performed. in line with 1st example, expected: (0 | 1 | 'Whoop it' | 3 | 4 | 'Whoop it' | 6 | 'Whoop it' | 8 | 9)[]\r\ntype WhoopedArray2 = WhoopMyArray_Faulty\u003cArr2, 7 | 5 | 2\u003e\r\ntype WhoopedArray2Keys = WhoopMyArray_Faulty\u003cArr, 7 | 5 | 2\u003e[keyof Arr]\r\n```\r\ninfered types:\r\n\r\n```d.ts\r\ntype WhoopedArray = [0, 1, \"Whoop it\", 3, 4, \"Whoop it\", 6, \"Whoop it\", 8, 9]\r\n\r\ntype WhoopedArrayKeys = 0 | \"Whoop it\" | 1 | 3 | 4 | 6 | 8 | 9 | 10 | (() =\u003e string) | (() =\u003e string) \r\n  | (() =\u003e 0 | \"Whoop it\" | 1 | 3 | 4 | 6 | 8 | 9 | undefined) | ((...items: (0 | \"Whoop it\" | 1 | 3 | 4 | 6 | 8 | 9)[]) =\u003e number)\r\n  | {    ...;    } | ... 22 more ... | (() =\u003e IterableIterator\u003c...\u003e)\r\n\r\ntype WhoopedArray2 = (0 | 7 | 5 | 2 | 1 | 3 | 4 | 6 | 8 | 9)[]\r\n\r\ntype WhoopedArray2Keys = 0 | \"Whoop it\" | 1 | 3 | 4 | 6 | 8 | 9 | 10 | (() =\u003e string) | (() =\u003e string)\r\n  | (() =\u003e 0 | \"Whoop it\" | 1 | 3 | 4 | 6 | 8 | 9 | undefined) | ((...items: (0 | \"Whoop it\" | 1 | 3 | 4 | 6 | 8 | 9)[]) =\u003e number)\r\n| {     ...;    } | ... 22 more ... | (() =\u003e IterableIterator\u003c...\u003e)\r\n```\r\n\r\n\r\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```ts\r\n\"use strict\";\r\n\r\n```\r\n\r\n\r\n\u003c/details\u003e\r\n\r\n\r\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eCompiler Options\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"noImplicitAny\": true,\r\n    \"strictNullChecks\": true,\r\n    \"strictFunctionTypes\": true,\r\n    \"strictBindCallApply\": true,\r\n    \"noImplicitThis\": true,\r\n    \"noImplicitReturns\": true,\r\n    \"useDefineForClassFields\": true,\r\n    \"alwaysStrict\": true,\r\n    \"allowUnusedLabels\": true,\r\n    \"noEmitHelpers\": true,\r\n    \"noUnusedLocals\": true,\r\n    \"noUnusedParameters\": true,\r\n    \"preserveConstEnums\": true,\r\n    \"experimentalDecorators\": true,\r\n    \"emitDecoratorMetadata\": true,\r\n    \"moduleResolution\": 2,\r\n    \"target\": \"Latest\",\r\n    \"module\": \"ESNext\"\r\n  }\r\n}\r\n```\r\n\r\n\r\n\u003c/details\u003e\r\n\r\n**Playground Link:** [Provided](https://www.typescriptlang.org/play?strictPropertyInitialization=false\u0026useDefineForClassFields=true\u0026allowUnusedLabels=true\u0026noEmitHelpers=true\u0026noUnusedLocals=true\u0026noUnusedParameters=true\u0026esModuleInterop=false\u0026preserveConstEnums=true\u0026declaration=false\u0026target=99\u0026jsx=0\u0026ts=4.0.0-beta#code/C4TwDgpgBAggTnKBeKcIEMAmB7AdgGxCgG0AGAGigEZKAmSgZkoBZKBWSgNkoHZKAOSgE4AugFgAUJNCQoAdQAW2bGACyIeHHQgA+gDF0AV3ygAPACF0AZ2gQAHsAi5MV2Am0AZAJYBrCKfRcEAA+SgBhPEwvYC88YOQoAG8oKEkASDTiAGkIIi9cKD8QbAAzKEsbEQAudIyKiGzckSh7R2dXCOdo2NxajIB+KAByRWUwKGihvrSq8usGnJBm1qcXOZtiXEMAWwAjCDhmwfWFpqhZ3AgANwP0gF9JSQB6J6h0AGMYvAnXSDgS7BwbYQTBQb7odxECD4CDA3DAVy7QzACa4d74QyYCCudD4fBQK64wzYsFlTTaAB0YDg2GAtPAEGkDPkShUIPJIEWrhQoxU6g5+iMJhApk0vCgAB8oGxJVBaMFiEVSm5DkA)\r\n      ","author":{"url":"https://github.com/KilianKilmister","@type":"Person","name":"KilianKilmister"},"datePublished":"2020-08-15T16:11:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/40069/TypeScript/issues/40069"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d80f4588-2341-faa1-eae4-3f1a14d15999
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC88A:6E104:131B78:1B5D05:6A61FB38
html-safe-nonce5f9e659003c6ffc7ee6be0c8d39e57c0b3bbba678cf9ffc66f10b602e9b9ac1c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODhBOjZFMTA0OjEzMUI3ODoxQjVEMDU6NkE2MUZCMzgiLCJ2aXNpdG9yX2lkIjoiMTc3MzgyNzg5ODgyOTA0NDUzNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac34d75aa83d200f079c968dbdf1c0a564a6df682bf2eacdf48c69882ca1d720fb
hovercard-subject-tagissue:679602007
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/40069/issue_layout
twitter:imagehttps://opengraph.githubassets.com/65762d4bb9ab2a3dd2832475d26a706da821e38fe4ab3203d3a271532bd41076/microsoft/TypeScript/issues/40069
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/65762d4bb9ab2a3dd2832475d26a706da821e38fe4ab3203d3a271532bd41076/microsoft/TypeScript/issues/40069
og:image:altTypeScript Version: 4.0.0-beta (same behaviour in version 3.5.1 v3.5.1-Play Ground) Search Terms: "key in keyof Array", "keyof Array" Expected behavior: using key in ArrayType has the same behaviou...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameKilianKilmister
hostnamegithub.com
expected-hostnamegithub.com
None9e41a6fd863e96b9c7e9185dc317bf107dbbf8cb10efd6dea957211963f33775
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
release2ed5e9c44acb35dcc1d752e449d2a6f7a6164b7b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/40069#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F40069
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F40069
Sign up https://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/40069
Reloadhttps://github.com/microsoft/TypeScript/issues/40069
Reloadhttps://github.com/microsoft/TypeScript/issues/40069
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/40069
microsoft https://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Fork 13.6k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Star 110k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Code https://github.com/microsoft/TypeScript
Issues 5k+ https://github.com/microsoft/TypeScript/issues
Pull requests 21 https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality 0 https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Code https://github.com/microsoft/TypeScript
Issues https://github.com/microsoft/TypeScript/issues
Pull requests https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Using 'Key in keyof ArrayType' always returns an Array regardles of the value manipulation appliedhttps://github.com/microsoft/TypeScript/issues/40069#top
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/KilianKilmister
KilianKilmisterhttps://github.com/KilianKilmister
on Aug 15, 2020https://github.com/microsoft/TypeScript/issues/40069#issue-679602007
v3.5.1-Play Groundhttps://www.typescriptlang.org/play?strictPropertyInitialization=false&useDefineForClassFields=true&allowUnusedLabels=true&noEmitHelpers=true&noUnusedLocals=true&noUnusedParameters=true&esModuleInterop=false&preserveConstEnums=true&declaration=false&target=99&jsx=0&ts=3.5.1
#39726https://github.com/microsoft/TypeScript/issues/39726
#34780https://github.com/microsoft/TypeScript/issues/34780
type-fest/issues/119https://github.com/sindresorhus/type-fest/issues/119
Providedhttps://www.typescriptlang.org/play?strictPropertyInitialization=false&useDefineForClassFields=true&allowUnusedLabels=true&noEmitHelpers=true&noUnusedLocals=true&noUnusedParameters=true&esModuleInterop=false&preserveConstEnums=true&declaration=false&target=99&jsx=0&ts=4.0.0-beta#code/C4TwDgpgBAggTnKBeKcIEMAmB7AdgGxCgG0AGAGigEZKAmSgZkoBZKBWSgNkoHZKAOSgE4AugFgAUJNCQoAdQAW2bGACyIeHHQgA+gDF0AV3ygAPACF0AZ2gQAHsAi5MV2Am0AZAJYBrCKfRcEAA+SgBhPEwvYC88YOQoAG8oKEkASDTiAGkIIi9cKD8QbAAzKEsbEQAudIyKiGzckSh7R2dXCOdo2NxajIB+KAByRWUwKGihvrSq8usGnJBm1qcXOZtiXEMAWwAjCDhmwfWFpqhZ3AgANwP0gF9JSQB6J6h0AGMYvAnXSDgS7BwbYQTBQb7odxECD4CDA3DAVy7QzACa4d74QyYCCudD4fBQK64wzYsFlTTaAB0YDg2GAtPAEGkDPkShUIPJIEWrhQoxU6g5+iMJhApk0vCgAB8oGxJVBaMFiEVSm5DkA
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%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.