René's URL Explorer Experiment


Title: Regression 5.4: the new conditional type constraint is not working with a type parameter representing union type · Issue #57864 · microsoft/TypeScript · GitHub

Open Graph Title: Regression 5.4: the new conditional type constraint is not working with a type parameter representing union type · Issue #57864 · microsoft/TypeScript

X Title: Regression 5.4: the new conditional type constraint is not working with a type parameter representing union type · Issue #57864 · microsoft/TypeScript

Description: 🔎 Search Terms regression, type parameter, 5.4 🕗 Version & Regression Information This is a crash This changed between versions 5.3.3 and 5.4.2 ⏯ Playground Link https://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAggznAlgcwHYCUJw...

Open Graph Description: 🔎 Search Terms regression, type parameter, 5.4 🕗 Version & Regression Information This is a crash This changed between versions 5.3.3 and 5.4.2 ⏯ Playground Link https://www.typescriptlang.org/play...

X Description: 🔎 Search Terms regression, type parameter, 5.4 🕗 Version & Regression Information This is a crash This changed between versions 5.3.3 and 5.4.2 ⏯ Playground Link https://www.typescriptlang.org/...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression 5.4: the new conditional type constraint is not working with a type parameter representing union type","articleBody":"### 🔎 Search Terms\n\nregression, type parameter, 5.4\n\n### 🕗 Version & Regression Information\n\n- This is a crash\r\n- This changed between versions 5.3.3 and 5.4.2\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAggznAlgcwHYCUJwK4BtgA8MATsVBAB7ASoAmcUA9gEYBWEAxsANoC6AfFAC8sUgCgxAeklRuqPLgA0UeQFtmEYsux0IAM0SoItZXGDFDyXsMFzs6zafOXeY0JCgAxRPk1FSygAqjADyqojAgiIkZJTUdAzchnqaUAASEACGJlAAdPnJqYGZPq5QUAD86Vm05FQ09FDBYRFi5eVV3r7EBMU+QaHhkW3tAFyyGdnK+bld1D19Sk2DEfxlUON8ANwS7tAA6ozEANZwAAoWRwCsACwEAMp18Y0s7FxQAD4qClGwCCgYLB4QhzPz3ZTyXC4fj8XbgA5HU7CP5INCYHD4AignqvTjAT7fKEQn78IA\n\n### 💻 Code\n\nThis is the simplified code\r\n```ts\r\ntype AssignResult\u003cArr extends object[]> = Arr\r\n\r\n// [null, number, undefined, string] => [number, string]\r\ntype Filter\u003cArr, ToOmit> = Arr extends [infer Head, ...infer Tail]\r\n  ? Head extends ToOmit\r\n    ? Filter\u003cTail, ToOmit>\r\n    : [Head, ...Filter\u003cTail, ToOmit>]\r\n  : [];\r\n\r\ntype WorksPrior54\u003cS extends object | null> = AssignResult\u003cFilter\u003cS, null>>\r\n\r\ntype Works = AssignResult\u003cFilter\u003cobject | null, null>>\r\n```\r\n\u003cdetails>\r\n  \u003csummary>This is the full code (error message is slightly different, but probably they are the same):\u003c/summary>\r\n\r\n```typescript\r\ntype AssignResult\u003cArr extends object[]> = Arr extends [...infer Rest extends object[], infer Last]\r\n  ? {\r\n    [K in keyof Last | keyof AssignResult\u003cRest>]: K extends keyof Last\r\n      ? Last[K]\r\n      : K extends keyof AssignResult\u003cRest>\r\n        ? AssignResult\u003cRest>[K]\r\n        : never;\r\n  }\r\n  : object;\r\n\r\ntype Filter\u003cArr, ToOmit> = Arr extends [infer Head, ...infer Tail]\r\n  ? Head extends ToOmit\r\n    ? Filter\u003cTail, ToOmit>\r\n    : [Head, ...Filter\u003cTail, ToOmit>]\r\n  : [];\r\n\r\ndeclare function assignByDescriptors\u003c\r\n  Target extends object,\r\n  // replace the two lines below to make it work with the this line\r\n  // Sources extends (object | null | undefined)[],\r\n  Source extends object | null | undefined,\r\n  Sources extends Source[],\r\n  Result extends AssignResult\u003c[Target, ...Filter\u003cSources, null | undefined>]> = AssignResult\u003c[Target, ...Filter\u003cSources, null | undefined>]>\r\n>(target: Target, ...sources: Sources): Result\r\n```\r\n\r\n\u003c/details>\n\n### 🙁 Actual behavior\n\nI would expect to have no error for 5.4, the same as there was no error before it. Especially considering that there were not breaking changes in 5.4 announcement.\r\n\r\nAs for the simplified code, there should be no difference between how `WorksPrior54` and `Works`.\r\n\r\nAs for the full version of the code, there should be no difference if part of `Sources` type parameter is extracted into an intermediate `Source` type parameter, or not\n\n### 🙂 Expected behavior\n\nError (in the simplified version): \r\n```\r\nTS2344: Type Filter\u003cS, null> does not satisfy the constraint object[]\r\nType [] | [unknown] is not assignable to type object[]\r\nType [unknown] is not assignable to type object[]\r\n```\r\nError (in the full version):\r\n```\r\nTS2344: Type\r\n[Target, ...Filter\u003cSources, null | undefined>]\r\ndoes not satisfy the constraint object[]\r\nType\r\nTarget | Filter\u003cSources, null | undefined>[number]\r\nis not assignable to type object\r\nType Filter\u003cSources, null | undefined>[number] is not assignable to type object\r\nType\r\n(Source extends null | undefined ? [] : [Source])[number] | (Source extends null | undefined ? [] : [Source])[number]\r\nis not assignable to type object\r\nType\r\n(Source extends null | undefined ? [] : [Source])[number]\r\nis not assignable to type object\r\n```\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/Alexsey","@type":"Person","name":"Alexsey"},"datePublished":"2024-03-20T18:12:52Z","url":"https://github.com/microsoft/TypeScript/issues/57864"}

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:493b4a68-3c1a-248f-9923-bca674fddeba
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA640:5028D:2703B0:32AFC9:6B04F0E5
html-safe-noncef0d8de4dc56ce0204b3eae98abc4fae3d9613da4f791751ec832c2b44fde7fc4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjQwOjUwMjhEOjI3MDNCMDozMkFGQzk6NkIwNEYwRTUiLCJ2aXNpdG9yX2lkIjoiMzc3OTk0NDQ5Nzg4MzE4MTI4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac67663fcbda06c28553e1d7f3d55935b1771b02ce267fed4fc868478a1970689b
hovercard-subject-tagissue:2198232634
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/57864/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5513c7e9d67e56d80e1c25fa6d44ecfe081276908cd75ef8151706411f5295dd/microsoft/TypeScript/issues/57864
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5513c7e9d67e56d80e1c25fa6d44ecfe081276908cd75ef8151706411f5295dd/microsoft/TypeScript/issues/57864
og:image:alt🔎 Search Terms regression, type parameter, 5.4 🕗 Version & Regression Information This is a crash This changed between versions 5.3.3 and 5.4.2 ⏯ Playground Link https://www.typescriptlang.org/play...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAlexsey
hostnamegithub.com
expected-hostnamegithub.com
Nonec0ff704de2671f716381d0ef36115cddb81606dd5397a5b003230bb8c02d623b
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
releasecbe60d43d23e17438879ed212ad20068394651c4
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/57864#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F57864
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%2F57864
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/57864
Reloadhttps://github.com/microsoft/TypeScript/issues/57864
Reloadhttps://github.com/microsoft/TypeScript/issues/57864
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests319 (319)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/57864
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/57864
Regression 5.4: the new conditional type constraint is not working with a type parameter representing union typehttps://github.com/microsoft/TypeScript/issues/57864#top
Working as Intendedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
https://github.com/Alexsey
Aleksey Bobyr (Alexsey)https://github.com/Alexsey
on Mar 20, 2024https://github.com/microsoft/TypeScript/issues/57864#issue-2198232634
https://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAggznAlgcwHYCUJwK4BtgA8MATsVBAB7ASoAmcUA9gEYBWEAxsANoC6AfFAC8sUgCgxAeklRuqPLgA0UeQFtmEYsux0IAM0SoItZXGDFDyXsMFzs6zafOXeY0JCgAxRPk1FSygAqjADyqojAgiIkZJTUdAzchnqaUAASEACGJlAAdPnJqYGZPq5QUAD86Vm05FQ09FDBYRFi5eVV3r7EBMU+QaHhkW3tAFyyGdnK+bld1D19Sk2DEfxlUON8ANwS7tAA6ozEANZwAAoWRwCsACwEAMp18Y0s7FxQAD4qClGwCCgYLB4QhzPz3ZTyXC4fj8XbgA5HU7CP5INCYHD4AignqvTjAT7fKEQn78IAhttps://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAggznAlgcwHYCUJwK4BtgA8MATsVBAB7ASoAmcUA9gEYBWEAxsANoC6AfFAC8sUgCgxAeklRuqPLgA0UeQFtmEYsux0IAM0SoItZXGDFDyXsMFzs6zafOXeY0JCgAxRPk1FSygAqjADyqojAgiIkZJTUdAzchnqaUAASEACGJlAAdPnJqYGZPq5QUAD86Vm05FQ09FDBYRFi5eVV3r7EBMU+QaHhkW3tAFyyGdnK+bld1D19Sk2DEfxlUON8ANwS7tAA6ozEANZwAAoWRwCsACwEAMp18Y0s7FxQAD4qClGwCCgYLB4QhzPz3ZTyXC4fj8XbgA5HU7CP5INCYHD4AignqvTjAT7fKEQn78IA
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Mar 20, 2024https://github.com/microsoft/TypeScript/issues/57864#issuecomment-2010498782
https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/#more-accurate-conditional-type-constraintshttps://devblogs.microsoft.com/typescript/announcing-typescript-5-4/#more-accurate-conditional-type-constraints
playground linkhttps://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAggznAlgcwHYCUJwK4BtgA8MATsVBAB7ASoAmcU2qA1qgPYDuqA2gLoB8UALyxSAKDEB6SVG6o8uADRR5AWwBGEYsqa0IAM0SoItZXGDEjyXsMFzsGrWYtXeY0JCgAxRPi1FSZQAVNgB5VURgQRESMkpqOgZuI30tKAAJCABDUygAOgKUtKCs3zcoKAB+DOzacioaeigQ8MixCorqnz9iAhLfYLCIqPaOgC5ZTJzlArzu6l7+pWahyP5yqAm+AG4JD2gAdTZiZjgABUtjgFYAFgIAZXqEprZ1ACsIAGNgKAAfFQU0VgCBQGCweEI83892U8lwuH4-D24EOx1OwmBSDQmBw+AIUN6rw+3z+APhsMB-CAA
playground linkhttps://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAggznAlgcwHYCUJwK4BtgA8MATsVBAB7ASoAmcUA9gEYBWEAxsANoC6AfFAC8sUgCgxAeklRuqPLgA0UeQFtmEYsux0IAM0SoItZXGDFDyXsMFzs6zafOXeY0JCgAxRPk1FSygAqjADyqojAgiIkZJTUdAzchnqaUAASEACGtORUNPRMbJzAygB05cmpgZk+ufEFLOxcfK5QUAD86Vk5cfkMwWERYm1tnd6+xATVPkGh4ZHDIwBcshnZZeXj1JPTSlAD8-ytUCt8ANwS7tAA6ozEANZwAAoWdwCsACwEAMp1fYVNYBQAA+KgUUVgCBQGCweEIWz832U8lwuH4-Eu4Bud0ewkhSDQmBw+AICMmjWKILBqOR4P4QA
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Working as Intendedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
on Mar 20, 2024https://github.com/microsoft/TypeScript/issues/57864#event-12190821334
https://github.com/Alexsey
Aleksey Bobyr (Alexsey)https://github.com/Alexsey
on Mar 20, 2024https://github.com/microsoft/TypeScript/issues/57864#issuecomment-2010583280
Daniel Rosenwasser (@DanielRosenwasser)https://github.com/DanielRosenwasser
Aleksey Bobyr (Alexsey)https://github.com/Alexsey
on Mar 20, 2024https://github.com/microsoft/TypeScript/issues/57864#event-12191180967
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Mar 20, 2024https://github.com/microsoft/TypeScript/issues/57864#issuecomment-2010689873
#56004https://github.com/microsoft/TypeScript/pull/56004
Try it out in the 5.3.3 playgroundhttps://www.typescriptlang.org/play?ts=5.3.3#code/C4TwDgpgBAYglgG2BATgHgIIpQGigFQHsB5AWzmAD4oBeKLFKCAD2QDsATAZygG042AM1RQAEhACGHPADo5A4Y3wTEAXQBQUKAH4xkjk1YROPImQqatO2ImTpliPGfJVLWgFx9xU2XPhJUNAcEJxIXSg0PPlUAbnV1QQBXNgBjYDhCNihBNABlQ3ZuKEIAIwArCDSoAB8oNkSEBEoACmZPfzs8vHrGygBKKABvSxTMrmAoCU9SirTeVVooZjitUbZxqBLPetIS1HnF5agAemOoAHVRDHxtEbGJlM9xlAEAcwO6I9OLq5vLO-WEw4ng+SxiJzOxAA1hIQHhgAALCQTFhgBAqdZQCgyAEbCAgmaVYALT7g74ATUSYHhCLgPEy0FeEGAPAkWVQKEIjAAtFBSBIoRAeFxjCK6oQAO44gC+6iAA
In 5.4+, these all error as expectedhttps://www.typescriptlang.org/play?ts=5.4.2#code/C4TwDgpgBAYglgG2BATgHgIIpQGigFQHsB5AWzmAD4oBeKLFKCAD2QDsATAZygG042AM1RQAEhACGHPADo5A4Y3wTEAXQBQUKAH4xkjk1YROPImQqatO2ImTpliPGfJVLWgFx9xU2XPhJUNAcEJxIXSg0PPlUAbnV1QQBXNgBjYDhCNihBNABlQ3ZuKEIAIwArCDSoAB8oNkSEBEoACmZPfzs8vHrGygBKKABvSxTMrmAoCU9SirTeVVooZjitUbZxqBLPetIS1HnF5agAemOoAHVRDHxtEbGJlM9xlAEAcwO6I9OLq5vLO-WEw4ng+SxiJzOxAA1hIQHhgAALCQTFhgBAqdZQCgyAEbCAgmaVYALT7g74ATUSYHhCLgPEy0FeEGAPAkWVQKEIjAAtFBSBIoRAeFxjCK6oQAO44gC+6iAA
https://github.com/Alexsey
Aleksey Bobyr (Alexsey)https://github.com/Alexsey
on Mar 20, 2024https://github.com/microsoft/TypeScript/issues/57864#issuecomment-2010730368
Daniel Rosenwasser (@DanielRosenwasser)https://github.com/DanielRosenwasser
https://github.com/typescript-bot
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
on Mar 23, 2024https://github.com/microsoft/TypeScript/issues/57864#issuecomment-2016268232
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
not plannedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Mar 23, 2024https://github.com/microsoft/TypeScript/issues/57864#event-12222963807
microsofthttps://github.com/microsoft
on Oct 22, 2025https://github.com/microsoft/TypeScript/issues/57864#event-20419648380
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/57864
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/57864
Working as Intendedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.