René's URL Explorer Experiment


Title: index operator and object spread · Issue #17849 · microsoft/TypeScript · GitHub

Open Graph Title: index operator and object spread · Issue #17849 · microsoft/TypeScript

X Title: index operator and object spread · Issue #17849 · microsoft/TypeScript

Description: TypeScript Version: 2.4.2 Code interface HasIndex { [key : string] : number } interface HasPropWithHasIndex { hasIndex ?: HasIndex } // one - works fine const obj1 : HasPropWithHasIndex = { hasIndex: { a: 1 } } // two - works fine const ...

Open Graph Description: TypeScript Version: 2.4.2 Code interface HasIndex { [key : string] : number } interface HasPropWithHasIndex { hasIndex ?: HasIndex } // one - works fine const obj1 : HasPropWithHasIndex = { hasInde...

X Description: TypeScript Version: 2.4.2 Code interface HasIndex { [key : string] : number } interface HasPropWithHasIndex { hasIndex ?: HasIndex } // one - works fine const obj1 : HasPropWithHasIndex = { hasInde...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"index operator and object spread","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:**  2.4.2\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface HasIndex {\r\n    [key : string] : number\r\n}\r\ninterface HasPropWithHasIndex {\r\n    hasIndex ?: HasIndex\r\n}\r\n\r\n// one - works fine\r\nconst obj1 : HasPropWithHasIndex = {\r\n    hasIndex: {\r\n        a: 1\r\n    }\r\n}\r\n\r\n// two - works fine\r\nconst test2 = { a: 1 }\r\nconst obj2 : HasPropWithHasIndex = {\r\n    hasIndex: test2\r\n}\r\n\r\n// three - doesn't work\r\nconst obj = {\r\n    a: 1,\r\n    b: 2,\r\n    c: 3,\r\n}\r\nconst { a, ...test3 } = obj\r\n// Error: Index signature is missing in type '{ b: number; c: number; }'.\r\nconst obj3 : HasPropWithHasIndex = {\r\n    hasIndex: test3,\r\n}\r\n\r\n// four - test4 should be of type number, is instead of type any\r\nconst test4 = test3['a']\r\n```\r\n\r\n**Expected behavior:**\r\nThe `obj3` assignment in test three should work without an issue.\r\n`test4` in test four should be of type `number`\r\n\r\n**Actual behavior:**\r\nThe `obj3` assignment in test three throws an error: `Index signature is missing in type '{ b: number; c: number; }'.`\r\n`test4` is of type `any`.\r\n\r\nIt looks like when you use the spread operator, typescript changes the type of the index operator to return `any`.","author":{"url":"https://github.com/bradzacher","@type":"Person","name":"bradzacher"},"datePublished":"2017-08-16T23:25:25Z","url":"https://github.com/microsoft/TypeScript/issues/17849"}

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:237b488d-6618-3176-e1d8-a8aaf28585b6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDC46:269AD9:9B161C:D12AD1:6B00EA4C
html-safe-noncee831613f39a94211d357229747588e555b895e487fab44530d53e974e8aca264
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzQ2OjI2OUFEOTo5QjE2MUM6RDEyQUQxOjZCMDBFQTRDIiwidmlzaXRvcl9pZCI6IjU5ODQ1MDQ2MjM0MDk0NTc3NDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacfaa6fc884ce8ad3add6aa9a56308847bc8e03053463d793cc9129a9abaae80b8
hovercard-subject-tagissue:250788413
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/17849/issue_layout
twitter:imagehttps://opengraph.githubassets.com/cfe4a073d129a6874a9873abb472a1ad025047eacf1a325e03207424a317b709/microsoft/TypeScript/issues/17849
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/cfe4a073d129a6874a9873abb472a1ad025047eacf1a325e03207424a317b709/microsoft/TypeScript/issues/17849
og:image:altTypeScript Version: 2.4.2 Code interface HasIndex { [key : string] : number } interface HasPropWithHasIndex { hasIndex ?: HasIndex } // one - works fine const obj1 : HasPropWithHasIndex = { hasInde...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebradzacher
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/17849#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F17849
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%2F17849
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/17849
Reloadhttps://github.com/microsoft/TypeScript/issues/17849
Reloadhttps://github.com/microsoft/TypeScript/issues/17849
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests308 (308)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/17849
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/17849
index operator and object spreadhttps://github.com/microsoft/TypeScript/issues/17849#top
https://github.com/sandersn
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
https://github.com/bradzacher
Brad Zacher (bradzacher)https://github.com/bradzacher
on Aug 16, 2017https://github.com/microsoft/TypeScript/issues/17849#issue-250788413
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Aug 18, 2017https://github.com/microsoft/TypeScript/issues/17849#issuecomment-323226709
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
#7029https://github.com/microsoft/TypeScript/pull/7029
https://github.com/olegdunkan
olegdunkanhttps://github.com/olegdunkan
on Aug 18, 2017https://github.com/microsoft/TypeScript/issues/17849#issuecomment-323455307
#7029https://github.com/microsoft/TypeScript/pull/7029
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
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
on Aug 29, 2017https://github.com/microsoft/TypeScript/issues/17849#event-1226590503
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Sep 12, 2017https://github.com/microsoft/TypeScript/issues/17849#event-1246233283
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jul 23, 2019https://github.com/microsoft/TypeScript/issues/17849#issuecomment-514045862
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 23, 2019https://github.com/microsoft/TypeScript/issues/17849#event-2501735675
https://github.com/benhamlin
Ben Hamlin (benhamlin)https://github.com/benhamlin
on Jun 4, 2020https://github.com/microsoft/TypeScript/issues/17849#issuecomment-638984896
https://github.com/koba04
Toru Kobayashi (koba04)https://github.com/koba04
on Aug 13, 2020https://github.com/microsoft/TypeScript/issues/17849#issuecomment-673367729
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://www.typescriptlang.org/play?#code/C4TwDgpgBAglC8UDeUDaBrCIBcUDOwATgJYB2A5gLq4EkVQC+A3AFAsBuAhoVAPYBGAKwTIoAM169cAcgm9pAGij9uMlYUXLOALzU7pzFgGNepAsgB0VwhAIMRAwa2OnzAW05hIAE1wpUnFBkUJggvGJQoJDhUDYE1PhEZOSMInHAzlw8vOi4cIiOrFl86ABMeSJIVhbphsU5AMwViB5eEN4c3FAQhIS8hM2xthksQAhttps://www.typescriptlang.org/play#code/C4TwDgpgBAglC8UDeUDaBrCIBcUDOwATgJYB2A5gLq4EkVQC+A3AFAsBuAhoVAPYBGAKwTIoAM169cAcgm9pAGij9uMlYUXLOALzU7pzFgGNepAsgB0VwhAIMRAwa2OnzAW05hIAE1wpUnFBkUJggvGJQoJDhUDYE1PhEZOSMInHAzlw8vOi4cIiOrFl86ABMeSJIVhbphsU5AMwViB5eEN4c3FAQhIS8hM2xthksQA
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/17849
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/17849
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
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
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.