René's URL Explorer Experiment


Title: Assignability false positive for recursive mapped types, even when fully instantiated · Issue #55535 · microsoft/TypeScript · GitHub

Open Graph Title: Assignability false positive for recursive mapped types, even when fully instantiated · Issue #55535 · microsoft/TypeScript

X Title: Assignability false positive for recursive mapped types, even when fully instantiated · Issue #55535 · microsoft/TypeScript

Description: 🔎 Search Terms recursive mapped types, assignability, depth check, deeply nested 🕗 Version & Regression Information If this is in fact a bug, it looks like it was introduced in v4.5 This can cause a runtime error when using incompatible ...

Open Graph Description: 🔎 Search Terms recursive mapped types, assignability, depth check, deeply nested 🕗 Version & Regression Information If this is in fact a bug, it looks like it was introduced in v4.5 This can cause ...

X Description: 🔎 Search Terms recursive mapped types, assignability, depth check, deeply nested 🕗 Version & Regression Information If this is in fact a bug, it looks like it was introduced in v4.5 This can ca...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Assignability false positive for recursive mapped types, even when fully instantiated","articleBody":"### 🔎 Search Terms\r\n\r\nrecursive mapped types, assignability, depth check, deeply nested\r\n\r\n### 🕗 Version & Regression Information\r\nIf this is in fact a bug, it looks like it was introduced in v4.5\r\n\r\n- This can cause a runtime error when using incompatible values whose types are derived from recursive mapped types with more than 2 levels of nesting because the compiler seems to consider them equal (even when the derived type is fully instantiated (not infinite)).\r\n- This changed between versions v4.4 and v4.5\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://tsplay.dev/WoM1gN\r\n\r\n### 💻 Code\r\n\r\n```typescript\r\ntype Id\u003cT> = { [K in keyof T]: Id\u003cT[K]> }\r\n\r\ntype HasNumeric = Id\u003c{ x: { y: { z: number } } }>\r\n//   ^? type HasNumeric = { x: { y: { z: number } } }\r\n\r\ntype HasString = Id\u003c{ x: { y: { z: string } } }>\r\n//   ^? type HasString = { x: { y: { z: string } } }\r\n\r\nconst toDollarsAndCents = (_: HasNumeric): string => _.x.y.z.toFixed(2)\r\n\r\ndeclare const illegalValue: HasString\r\n//            ^? const illegalValue:  { x: { y: { z: string } } }\r\n \r\n/** 😵 */\r\ntoDollarsAndCents(illegalValue) \r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nI passed a value known by the compiler to be of type `{ x: { y: { z: string } } }` to a function expecting `{ x: { y: { z: number } } }` and did not get a compile time error warning me about it.\r\n\r\n### 🙂 Expected behavior\r\n\r\nI expect to get a compile time error when I pass a value known by the compiler to be of type `{ x: { y: { z: string } } }` to a function expecting `{ x: { y: { z: number } } }`\r\n\r\n### Additional information about the issue\r\n\r\nHey team! First of all, thank you for your work on this project. I have used TypeScript every day for years, and since the release of v5 in particular, saw a noticeable increase in my productivity at work :)\r\n\r\nRegarding this issue, after further testing, it seems pretty trivial to reproduce with any recursive mapped type more than 2 levels deep (even with a \"no-op\" transformation, as is the case with `Id`).\r\n\r\nEven if the type were not fully instantiated, the assignability rules in this case seem to work exactly backwards from what I'd expect, which makes me think this might not be the intended behavior.\r\n\r\nThis issue might be related to #46599, which fits given that the playground's type-checker [does complain in v4.4](https://tsplay.dev/mqyqrm)\r\n\r\nLet me know if there's anything you'd like me to elaborate on!","author":{"url":"https://github.com/ahrjarrett","@type":"Person","name":"ahrjarrett"},"datePublished":"2023-08-28T01:40:17Z","url":"https://github.com/microsoft/TypeScript/issues/55535"}

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:f74060cf-3f40-6607-1673-9362694b1da1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAEBA:172B92:256B322:31DCE85:6B01A23F
html-safe-nonce7adf910d005f026b948831e8426fa4924f244fa2138b16907c2b95dd2a6d95b0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRUJBOjE3MkI5MjoyNTZCMzIyOjMxRENFODU6NkIwMUEyM0YiLCJ2aXNpdG9yX2lkIjoiNzA0NzExMzM1OTYwMjMyODEyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca4b22c8ea37e374f2453a1e33c7ee3385a849a1dcc7bccd39374e7c289b2a1c3
hovercard-subject-tagissue:1868787554
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/55535/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3c9fe659b1eec12125930b12ce3dd9d82c4355c5d8effa9a911ded886002f3b6/microsoft/TypeScript/issues/55535
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3c9fe659b1eec12125930b12ce3dd9d82c4355c5d8effa9a911ded886002f3b6/microsoft/TypeScript/issues/55535
og:image:alt🔎 Search Terms recursive mapped types, assignability, depth check, deeply nested 🕗 Version & Regression Information If this is in fact a bug, it looks like it was introduced in v4.5 This can cause ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameahrjarrett
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/55535#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F55535
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%2F55535
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/55535
Reloadhttps://github.com/microsoft/TypeScript/issues/55535
Reloadhttps://github.com/microsoft/TypeScript/issues/55535
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/55535
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/55535
#55638https://github.com/microsoft/TypeScript/pull/55638
Assignability false positive for recursive mapped types, even when fully instantiatedhttps://github.com/microsoft/TypeScript/issues/55535#top
#55638https://github.com/microsoft/TypeScript/pull/55638
https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
TypeScript 5.3.0https://github.com/microsoft/TypeScript/milestone/189
https://github.com/ahrjarrett
andrew jarrett (ahrjarrett)https://github.com/ahrjarrett
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issue-1868787554
https://tsplay.dev/WoM1gNhttps://tsplay.dev/WoM1gN
#46599https://github.com/microsoft/TypeScript/pull/46599
does complain in v4.4https://tsplay.dev/mqyqrm
https://github.com/fatcerberus
Bruce Pascoe (fatcerberus)https://github.com/fatcerberus
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1694894788
#35533https://github.com/microsoft/TypeScript/issues/35533
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1695119114
isDeeplyNestedTypehttps://github.dev/microsoft/TypeScript/blob/8fae437660ba89353fc7104beae8c6856528e5b6/src/compiler/checker.ts#L22943
getRecursionIdentityhttps://github.dev/microsoft/TypeScript/blob/8fae437660ba89353fc7104beae8c6856528e5b6/src/compiler/checker.ts#L22975
herehttps://github.com/microsoft/TypeScript/issues/54246#issuecomment-1547329388
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
https://github.com/webstrand
webstrandhttps://github.com/webstrand
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696046877
https://github.com/ssalbdivad
David Blass (ssalbdivad)https://github.com/ssalbdivad
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696082482
Mateusz Burzyński (@Andarist)https://github.com/Andarist
https://github.com/ahrjarrett
andrew jarrett (ahrjarrett)https://github.com/ahrjarrett
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696505454
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
herehttps://github.com/microsoft/TypeScript/issues/52912#issuecomment-1440562390
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696515544
https://github.com/ssalbdivad
David Blass (ssalbdivad)https://github.com/ssalbdivad
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696525715
Mateusz Burzyński (@Andarist)https://github.com/Andarist
andrew jarrett (@ahrjarrett)https://github.com/ahrjarrett
https://github.com/fatcerberus
Bruce Pascoe (fatcerberus)https://github.com/fatcerberus
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696547176
https://github.com/ahrjarrett
andrew jarrett (ahrjarrett)https://github.com/ahrjarrett
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696550469
Mateusz Burzyński (@Andarist)https://github.com/Andarist
Bruce Pascoe (@fatcerberus)https://github.com/fatcerberus
https://github.com/ahrjarrett
andrew jarrett (ahrjarrett)https://github.com/ahrjarrett
on Aug 28, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696566727
Mateusz Burzyński (@Andarist)https://github.com/Andarist
webstrandhttps://github.com/webstrand
herehttps://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696046877
https://github.com/ssalbdivad
David Blass (ssalbdivad)https://github.com/ssalbdivad
on Aug 29, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1696595342
Bruce Pascoe (@fatcerberus)https://github.com/fatcerberus
https://github.com/ssalbdivad
David Blass (ssalbdivad)https://github.com/ssalbdivad
on Sep 2, 2023https://github.com/microsoft/TypeScript/issues/55535#issuecomment-1703854817
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
#46599https://github.com/microsoft/TypeScript/pull/46599
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Sep 4, 2023https://github.com/microsoft/TypeScript/issues/55535#event-10275672396
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
on Sep 5, 2023https://github.com/microsoft/TypeScript/issues/55535#event-10277707229
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
TypeScript 5.3.0https://github.com/microsoft/TypeScript/milestone/189
on Sep 5, 2023https://github.com/microsoft/TypeScript/issues/55535#event-10285317893
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Sep 5, 2023https://github.com/microsoft/TypeScript/issues/55535#event-10285815573
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#55638https://github.com/microsoft/TypeScript/pull/55638
on Sep 11, 2023https://github.com/microsoft/TypeScript/issues/55535#event-10338968412
microsofthttps://github.com/microsoft
on Oct 22, 2025https://github.com/microsoft/TypeScript/issues/55535#event-20419594693
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/55535
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/55535
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
TypeScript 5.3.0https://github.com/microsoft/TypeScript/milestone/189
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.