René's URL Explorer Experiment


Title: Accept de-structured elements in type predicates · Issue #41173 · microsoft/TypeScript · GitHub

Open Graph Title: Accept de-structured elements in type predicates · Issue #41173 · microsoft/TypeScript

X Title: Accept de-structured elements in type predicates · Issue #41173 · microsoft/TypeScript

Description: Search Terms type predicate reference binding pattern type predicate cannot reference destructured Suggestion The possibility to use destructured parameters in type predicates. Use Cases Destructuring is heavily used in functional/reacti...

Open Graph Description: Search Terms type predicate reference binding pattern type predicate cannot reference destructured Suggestion The possibility to use destructured parameters in type predicates. Use Cases Destructur...

X Description: Search Terms type predicate reference binding pattern type predicate cannot reference destructured Suggestion The possibility to use destructured parameters in type predicates. Use Cases Destructur...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Accept de-structured elements in type predicates","articleBody":"## Search Terms\r\n\r\n- type predicate\r\n- reference binding pattern\r\n- type predicate cannot reference\r\n- destructured\r\n\r\n## Suggestion\r\n\r\nThe possibility to use destructured parameters in type predicates.\r\n\r\n## Use Cases\r\n\r\nDestructuring is heavily used in functional/reactive programming, notably with rxjs where various contextual properties tend to be passed between each operator.\r\n\r\nHaving the ability to succinctly test for types would make the code more readable, e.g.:\r\n```typescript\r\ntype Example = {\r\n  a: number;\r\n  b: string | undefined;\r\n};\r\n\r\nconst example: Example = {\r\n  a: 42,\r\n  b: 'hello';\r\n};\r\n\r\nof(example).pipe(\r\n  guard(({ b }): b is string => b !== undefined, 'b cannot be undefined'),\r\n  tap({ b }) => { /* b is now a string rather than a string | undefined })\r\n);\r\n```\r\nRight now the alternative is\r\n```typescript\r\nof(example).pipe(\r\n  guard((x): x is Omit\u003ctypeof x, 'b'> & { b: string } => x.b !== undefined, 'b cannot be undefined'),\r\n  tap({ b }) => { /* b is now a string rather than a string | undefined })\r\n);\r\n```\r\nOr, without a predicate\r\n```typescript\r\nof(example).pipe(\r\n  map(x => {\r\n    if (x.b === undefined) {\r\n      throw new Error();\r\n    }\r\n\r\n    return x;\r\n  }),\r\n  tap({ b }) => { /* b is now a string rather than a string | undefined })\r\n);\r\n```\r\n\r\n## Examples\r\n\r\n```typescript\r\nfunction assertSomething(\r\n  { property }: T\r\n): property is AssertionHere {\r\n  return true;\r\n}\r\n```\r\n\r\nThis would roughly translate to something like:\r\n\r\n```typescript\r\nfunction assertSomething(\r\n  obj: T\r\n): obj is Omit\u003cT, 'property'> & { property: AssertionHere } {\r\n  return true;\r\n}\r\n```\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)\r\n* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n","author":{"url":"https://github.com/rraziel","@type":"Person","name":"rraziel"},"datePublished":"2020-10-20T09:41:59Z","url":"https://github.com/microsoft/TypeScript/issues/41173"}

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:217e60c7-c844-ee80-0a6c-bff12d42dd5e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB566:95C88:AC7865:E61858:6B00EBCA
html-safe-nonce2fc6525a7a6bbbd83f7698e225e7767ec4d8781956ad8946ddf6af133a34565d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTY2Ojk1Qzg4OkFDNzg2NTpFNjE4NTg6NkIwMEVCQ0EiLCJ2aXNpdG9yX2lkIjoiMzMzNzU5MjEzMTI3OTIwNTg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac19d452ed4951e0510fb0b9930cf701df85b878ff5ad435d148ab34b4a9461110
hovercard-subject-tagissue:725402325
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/41173/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4fda2426860cacd2ba451613f0a636c6110670eec630e1912ac75e4426e3781d/microsoft/TypeScript/issues/41173
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4fda2426860cacd2ba451613f0a636c6110670eec630e1912ac75e4426e3781d/microsoft/TypeScript/issues/41173
og:image:altSearch Terms type predicate reference binding pattern type predicate cannot reference destructured Suggestion The possibility to use destructured parameters in type predicates. Use Cases Destructur...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerraziel
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-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/41173#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F41173
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%2F41173
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/41173
Reloadhttps://github.com/microsoft/TypeScript/issues/41173
Reloadhttps://github.com/microsoft/TypeScript/issues/41173
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/41173
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/41173
Accept de-structured elements in type predicateshttps://github.com/microsoft/TypeScript/issues/41173#top
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/rraziel
Raziel (rraziel)https://github.com/rraziel
on Oct 20, 2020https://github.com/microsoft/TypeScript/issues/41173#issue-725402325
TypeScript's Design Goalshttps://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Nov 3, 2020https://github.com/microsoft/TypeScript/issues/41173#event-3954155025
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Nov 3, 2020https://github.com/microsoft/TypeScript/issues/41173#issuecomment-721288607
https://github.com/manbearwiz
Kevin Brey (manbearwiz)https://github.com/manbearwiz
on Nov 20, 2020https://github.com/microsoft/TypeScript/issues/41173#issuecomment-731371290
https://github.com/rraziel
Raziel (rraziel)https://github.com/rraziel
on Dec 1, 2020https://github.com/microsoft/TypeScript/issues/41173#issuecomment-736626449
https://github.com/iBlueDust
iBlueDust (iBlueDust)https://github.com/iBlueDust
on Jul 29, 2021https://github.com/microsoft/TypeScript/issues/41173#issuecomment-888996524
Raziel (@rraziel)https://github.com/rraziel
https://github.com/artu-ole
artu-olehttps://github.com/artu-ole
on Oct 5, 2021https://github.com/microsoft/TypeScript/issues/41173#issuecomment-934204773
Raziel (@rraziel)https://github.com/rraziel
combineLatesthttps://rxjs-dev.firebaseapp.com/api/index/function/combineLatest
https://github.com/Susccy
Susccyhttps://github.com/Susccy
on Jun 30, 2022https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1171104156
https://github.com/rgfretes
Ricardo German Fretes (rgfretes)https://github.com/rgfretes
on Jul 12, 2022https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1182557407
https://github.com/Yohandah
Yohan Dahmani (Yohandah)https://github.com/Yohandah
on Aug 3, 2022https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1203929343
https://github.com/dominik-widomski-jm
dominik-widomski-jmhttps://github.com/dominik-widomski-jm
on Sep 29, 2022https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1262007049
https://github.com/Wytrykus
Daniel (Wytrykus)https://github.com/Wytrykus
on Oct 25, 2022https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1290339659
https://github.com/konstantinmv
Konstantin (konstantinmv)https://github.com/konstantinmv
on Nov 29, 2022https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1330953399
https://github.com/OliverLeighC
Oliver Coley (OliverLeighC)https://github.com/OliverLeighC
on May 10, 2023https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1542596714
https://github.com/karatekid430
karatekid430https://github.com/karatekid430
on Jun 21, 2023https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1600369833
https://github.com/avin-kavish
Avin (avin-kavish)https://github.com/avin-kavish
on Jul 18, 2023https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1640057934
https://github.com/Expertus777
Expert (Expertus777)https://github.com/Expertus777
on Aug 2, 2023https://github.com/microsoft/TypeScript/issues/41173#issuecomment-1662315981
https://github.com/Lonli-Lokli
Lonli-Loklihttps://github.com/Lonli-Lokli
on Apr 19, 2024https://github.com/microsoft/TypeScript/issues/41173#issuecomment-2066820437
#57465https://github.com/microsoft/TypeScript/pull/57465
https://github.com/MMJZ
Michael Agius (MMJZ)https://github.com/MMJZ
on Jun 7, 2024https://github.com/microsoft/TypeScript/issues/41173#issuecomment-2155685893
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jun 13, 2024https://github.com/microsoft/TypeScript/issues/41173#issuecomment-2166090059
Michael Agius (@MMJZ)https://github.com/MMJZ
https://github.com/microsoft/TypeScript/wiki/FAQ#time-marches-onhttps://github.com/microsoft/TypeScript/wiki/FAQ#time-marches-on
https://github.com/microsoft/TypeScript/wiki/FAQ#what-kind-of-feedback-are-you-looking-forhttps://github.com/microsoft/TypeScript/wiki/FAQ#what-kind-of-feedback-are-you-looking-for
https://github.com/microsoft/TypeScript/wiki/FAQ#this-is-closed-but-should-be-open-or-vice-versahttps://github.com/microsoft/TypeScript/wiki/FAQ#this-is-closed-but-should-be-open-or-vice-versa
https://github.com/devuxer
Dan M. (devuxer)https://github.com/devuxer
on Jun 13, 2024https://github.com/microsoft/TypeScript/issues/41173#issuecomment-2166452757
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/aleksei-minkin-webcom
aleksei-minkin-webcomhttps://github.com/aleksei-minkin-webcom
on Feb 19, 2025https://github.com/microsoft/TypeScript/issues/41173#issuecomment-2668226289
https://github.com/mariusaarsnes
Marius Aarsnes (mariusaarsnes)https://github.com/mariusaarsnes
on Mar 20, 2025https://github.com/microsoft/TypeScript/issues/41173#issuecomment-2740322844
https://github.com/adam-marshall
adam-marshallhttps://github.com/adam-marshall
on Mar 25, 2025https://github.com/microsoft/TypeScript/issues/41173#issuecomment-2750780227
https://github.com/ljharb
Jordan Harband (ljharb)https://github.com/ljharb
on Jan 10, 2026https://github.com/microsoft/TypeScript/issues/41173#issuecomment-3733647068
#59497https://github.com/microsoft/TypeScript/issues/59497
https://github.com/DDD-fx
Dmitry (DDD-fx)https://github.com/DDD-fx
on Apr 8, 2026https://github.com/microsoft/TypeScript/issues/41173#issuecomment-4204447521
Jordan Harband (ljharb)https://github.com/ljharb
on Jun 19, 2026https://github.com/microsoft/TypeScript/issues/41173#event-26975089304
[New] add typeshttps://github.com/ljharb/ls-engines/commit/13ff435c2dabc51e379b7f82f380bde1564ff134
13ff435https://github.com/ljharb/ls-engines/commit/13ff435c2dabc51e379b7f82f380bde1564ff134
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/41173
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/41173
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%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.