René's URL Explorer Experiment


Title: Design Meeting Notes, 7/22/2022 · Issue #50008 · microsoft/TypeScript · GitHub

Open Graph Title: Design Meeting Notes, 7/22/2022 · Issue #50008 · microsoft/TypeScript

X Title: Design Meeting Notes, 7/22/2022 · Issue #50008 · microsoft/TypeScript

Description: Inference Change Between Unions of undefined #49938 Lots of examples Here's a minimal break. type B = { foo: string, }; type D = { foo: string, bar: number }; declare function equals(a: T, b: T): boolean; function f(b: B, d: D | undef...

Open Graph Description: Inference Change Between Unions of undefined #49938 Lots of examples Here's a minimal break. type B = { foo: string, }; type D = { foo: string, bar: number }; declare function equals(a: T, b: T)...

X Description: Inference Change Between Unions of undefined #49938 Lots of examples Here's a minimal break. type B = { foo: string, }; type D = { foo: string, bar: number }; declare function equals<T>(a...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 7/22/2022","articleBody":"# Inference Change Between Unions of `undefined`\r\n\r\nhttps://github.com/microsoft/TypeScript/issues/49938\r\n\r\n[Lots of examples](https://www.staging-typescript.org/play?ts=4.8.0-pr-49981-17#code/GYVwdgxgLglg9mABAUwI4gIYBsA8AVAPgAoMAuRPAGkQCNy8BKRAb0QF8AoDrZKRAN0QBeRGBBYsAQgDcXAPRzEAeRoArZNERQAngAdkAZ0QB3GFAAWiCHAC2NhLQwHkWvYa479iAELCWiYDg4cgMoACcYMABzdg5PFwARP1ZA4MRQiOjpRzDyMRsaZDDYjjRMLCJBJx9qKqNwABNkYEjkBsQAH0QEhg4FRAA9AH5S9GxKxGrG5tb2roTayaNvXv7hrjLsHGmWsDbOn2I6moElxB3Zg56+xXXN3Au9ucOJqbAm3f35xeqVm8GRqNyq9lj96u8Zk9VrcRvcQecIZ8GmCfNCARsxhVjt4Udc1rDMfCFqdfmj1kDxtiUb4uo82mSCcDsQc6ciScsGRwgA)\r\n\r\nHere's a minimal break.\r\n\r\n```ts\r\ntype B = { foo: string, };\r\ntype D = { foo: string, bar: number };\r\n\r\ndeclare function equals\u003cT>(a: T, b: T): boolean;\r\n\r\nfunction f(b: B, d: D | undefined) {\r\n    // Used to work, now infers `B` and fails.\r\n    if (equals(b, d)) {\r\n\r\n    }\r\n}\r\n```\r\n\r\n[Playground link](https://www.typescriptlang.org/play?ts=4.8.0-beta#code/C4TwDgpgBAQlC8UDeUBmB7dAuKBnYATgJYB2A5gDRQC+A3AFCiRQAiCyamO+x5VARgEMCOEgFcAtvwgEaDegBMIAYwA2w6KjEllwIuhJQIARzGDVuADwAVAHwAKQTmsDnAShz9MqiIJLytHT0DNHt+HBgqBRw2AB8obSVUUggFN2R6KCyoAHocqABVXFSoYHQoAHd0AgBrKhJ0CqhSVBlcKAADGA6oPwU0QSILADpM7KJUKHsTMwswqLd0pHoxrOp6aiA)\r\n\r\n* Bloomberg uncovered this from TS 4.8 Beta.\r\n* Why did this used to work?\r\n    * We would get all the candidates, toss out the `undefined`, try to find the common super type, and re-add `undefined`.\r\n    * Recent PR changed this (#49119), but https://github.com/microsoft/TypeScript/pull/49981 re-adds some of it.\r\n* Seems like we've found a middle-ground.\r\n* Didn't #49119 have\r\n    * But the check for falsy flags went away (`getFalsyFlagsOfTypes` is a recursive fetch of flags)\r\n* Is this a desirable fix? Seems like a heuristic.\r\n    * You can keep going and find use-cases where it becomes more and more arguable that you want to let things work.\r\n    * Regardless, need to fix before 4.8.\r\n\r\n# Narrowing Changes Against Top-ish Types\r\n\r\nhttps://github.com/microsoft/TypeScript/issues/49988\r\n\r\n* The `isMap` type predicate now narrows values to a `Map\u003c...> | ReadonlyMap\u003c...>` instead of `Map\u003c...>` if that's what you already had.\r\n* Introduced by https://github.com/microsoft/TypeScript/pull/49625\r\n* Start with this example.\r\n\r\n  ```ts\r\n  type Falsy = false | 0 | 0n | '' | null | undefined;\r\n\r\n  declare function isFalsy(value: unknown): value is Falsy;\r\n\r\n  function fx1(x: string | number | undefined) {\r\n      if (isFalsy(x)) {\r\n          x;  // \"\" | 0 | undefined, previously undefined\r\n      }\r\n  }\r\n  ```\r\n* But people depend on the old behavior.\r\n* This is now different\r\n  ```ts\r\n  declare function isMap\u003cT>(object: T | {}): object is T extends ReadonlyMap\u003cany, any> ? (unknown extends T ? never : ReadonlyMap\u003cany, any>) : Map\u003cunknown, unknown>;\r\n  declare const romor: ReadonlyMap\u003cany, any> | Record\u003cany, any>\r\n  if (isMap(romor)) {\r\n      romor; // Previously `ReadonlyMap\u003cany, any>`, now `ReadonlyMap\u003cany, any> | Map\u003cany, any>`\r\n  }\r\n  ```\r\n* But `ReadonlyMap\u003c...> | Map\u003c...>` just provides all the same methods as `ReadonlyMap\u003c...>`.\r\n    * Are they sufficiently identical between their methods?\r\n    * Often these signatures are not, which makes them effectively uncallable.\r\n    * We think yes.\r\n* [The `isObject` case is worse](https://github.com/microsoft/TypeScript/issues/49988#issuecomment-1192744372).\r\n    * Previous behavior was weird! ([see playground](https://www.typescriptlang.org/play?ts=4.7.4#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXywGcB5AIwCtwMAKANygmRAC540BrVHAd1QEpW9RgiLwASuBwxgAHkIYYWVAHMANG1SceqAHwBuAFAGU6bHiQBGajgqsA3gF8+8OwfgFE8akTKVM1ij5nV3d3AHow+AB1KXZCdRtyAkJ4VFgYHhBgeAwccUlpOQUlNQ0tXh03UMSAbQAieWRERDqAXSqHA07jNExcfEQAJgDyewd4AB8NUEQlLOCqrE9vEgoqEaCXKvDIgBEsYFQAcgx4blj4ROTU9Mzs3PywKVl5RRV1Di4K7cuKesbmm0Ol0gA))\r\n\r\n      ```ts\r\n      declare function isObject(value: unknown): value is Record\u003cstring, unknown>;\r\n\r\n      function f1(obj: {}) {\r\n          if (isObject(obj)) {\r\n              // Worked, obj is narrowed to Record\u003cstring, unknown>\r\n              obj[\"stuff\"]\r\n          }\r\n      }\r\n\r\n      function f2(obj: {} | undefined) {\r\n          if (isObject(obj)) {\r\n              // Doesn't work obj is not narrowed.\r\n              obj[\"stuff\"]\r\n          }\r\n      }\r\n      ```\r\n    * Now neither example works. ([see playground](https://www.typescriptlang.org/play?ts=4.8.0-dev.20220722#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXywGcB5AIwCtwMAKANygmRAC540BrVHAd1QEpW9RgiLwASuBwxgAHkIYYWVAHMANG1SceqAHwBuAFAGU6bHiQBGajgqsA3gF8+8OwfgFE8akTKVM1ij5nV3d3AHow+AB1KXZCdRtyAkJ4VFgYHhBgeAwccUlpOQUlNQ0tXh03UMSAbQAieWRERDqAXSqHA07jNExcfEQAJgDyewd4AB8NUEQlLOCqrE9vEgoqEaCXKvDIgBEsYFQAcgx4blj4ROTU9Mzs3PywKVl5RRV1Di4K7cuKesbmm0Ol0gA))\r\n    * Will need to think through these.\r\n* `WeakRef` example\r\n    * Very incorrect. `T` is never witnessed, and `WeakRef` is supposed to be a proxy around `T` itself.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2022-07-22T18:57:43Z","url":"https://github.com/microsoft/TypeScript/issues/50008"}

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:be9ae03d-6d27-f667-97c1-bc1d241cdad9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8024:63875:B7ACC9:F4B370:6B00F0E6
html-safe-nonce44846cc31716f941dc19e4fa7f38a194d69c1b98cef482128aa5f0b100b22b65
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDI0OjYzODc1OkI3QUNDOTpGNEIzNzA6NkIwMEYwRTYiLCJ2aXNpdG9yX2lkIjoiNDM0MTM3OTcwNjUzMzI0NTE1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9dbc0813950ec5a6294cabf4a19d746e01cfbfd2b4eb40865c6c8ff67ca2da10
hovercard-subject-tagissue:1315324499
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/50008/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fb1b0ecd3cc4f468f1c27ca21a188886f90a464303b97dfbeb9d768fbf34034a/microsoft/TypeScript/issues/50008
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fb1b0ecd3cc4f468f1c27ca21a188886f90a464303b97dfbeb9d768fbf34034a/microsoft/TypeScript/issues/50008
og:image:altInference Change Between Unions of undefined #49938 Lots of examples Here's a minimal break. type B = { foo: string, }; type D = { foo: string, bar: number }; declare function equals(a: T, b: T)...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameDanielRosenwasser
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/50008#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F50008
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%2F50008
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/50008
Reloadhttps://github.com/microsoft/TypeScript/issues/50008
Reloadhttps://github.com/microsoft/TypeScript/issues/50008
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/50008
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/50008
Design Meeting Notes, 7/22/2022https://github.com/microsoft/TypeScript/issues/50008#top
Design NotesNotes from our design meetingshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Notes%22
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Jul 22, 2022https://github.com/microsoft/TypeScript/issues/50008#issue-1315324499
#49938https://github.com/microsoft/TypeScript/issues/49938
Lots of exampleshttps://www.staging-typescript.org/play?ts=4.8.0-pr-49981-17#code/GYVwdgxgLglg9mABAUwI4gIYBsA8AVAPgAoMAuRPAGkQCNy8BKRAb0QF8AoDrZKRAN0QBeRGBBYsAQgDcXAPRzEAeRoArZNERQAngAdkAZ0QB3GFAAWiCHAC2NhLQwHkWvYa479iAELCWiYDg4cgMoACcYMABzdg5PFwARP1ZA4MRQiOjpRzDyMRsaZDDYjjRMLCJBJx9qKqNwABNkYEjkBsQAH0QEhg4FRAA9AH5S9GxKxGrG5tb2roTayaNvXv7hrjLsHGmWsDbOn2I6moElxB3Zg56+xXXN3Au9ucOJqbAm3f35xeqVm8GRqNyq9lj96u8Zk9VrcRvcQecIZ8GmCfNCARsxhVjt4Udc1rDMfCFqdfmj1kDxtiUb4uo82mSCcDsQc6ciScsGRwgA
Playground linkhttps://www.typescriptlang.org/play?ts=4.8.0-beta#code/C4TwDgpgBAQlC8UDeUBmB7dAuKBnYATgJYB2A5gDRQC+A3AFCiRQAiCyamO+x5VARgEMCOEgFcAtvwgEaDegBMIAYwA2w6KjEllwIuhJQIARzGDVuADwAVAHwAKQTmsDnAShz9MqiIJLytHT0DNHt+HBgqBRw2AB8obSVUUggFN2R6KCyoAHocqABVXFSoYHQoAHd0AgBrKhJ0CqhSVBlcKAADGA6oPwU0QSILADpM7KJUKHsTMwswqLd0pHoxrOp6aiA
Improve intersection reduction and CFA for truthy, equality, and typeof checks #49119https://github.com/microsoft/TypeScript/pull/49119
Ensure common supertype retains nullability in inference #49981https://github.com/microsoft/TypeScript/pull/49981
Improve intersection reduction and CFA for truthy, equality, and typeof checks #49119https://github.com/microsoft/TypeScript/pull/49119
#49988https://github.com/microsoft/TypeScript/issues/49988
Improve narrowing logic for instanceof, type predicate functions, and assertion functions #49625https://github.com/microsoft/TypeScript/pull/49625
The isObject case is worsehttps://github.com/microsoft/TypeScript/issues/49988#issuecomment-1192744372
see playgroundhttps://www.typescriptlang.org/play?ts=4.7.4#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXywGcB5AIwCtwMAKANygmRAC540BrVHAd1QEpW9RgiLwASuBwxgAHkIYYWVAHMANG1SceqAHwBuAFAGU6bHiQBGajgqsA3gF8+8OwfgFE8akTKVM1ij5nV3d3AHow+AB1KXZCdRtyAkJ4VFgYHhBgeAwccUlpOQUlNQ0tXh03UMSAbQAieWRERDqAXSqHA07jNExcfEQAJgDyewd4AB8NUEQlLOCqrE9vEgoqEaCXKvDIgBEsYFQAcgx4blj4ROTU9Mzs3PywKVl5RRV1Di4K7cuKesbmm0Ol0gA
see playgroundhttps://www.typescriptlang.org/play?ts=4.8.0-dev.20220722#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXywGcB5AIwCtwMAKANygmRAC540BrVHAd1QEpW9RgiLwASuBwxgAHkIYYWVAHMANG1SceqAHwBuAFAGU6bHiQBGajgqsA3gF8+8OwfgFE8akTKVM1ij5nV3d3AHow+AB1KXZCdRtyAkJ4VFgYHhBgeAwccUlpOQUlNQ0tXh03UMSAbQAieWRERDqAXSqHA07jNExcfEQAJgDyewd4AB8NUEQlLOCqrE9vEgoqEaCXKvDIgBEsYFQAcgx4blj4ROTU9Mzs3PywKVl5RRV1Di4K7cuKesbmm0Ol0gA
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Design NotesNotes from our design meetingshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Notes%22
on Jul 22, 2022https://github.com/microsoft/TypeScript/issues/50008#event-7048510567
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 26, 2023https://github.com/microsoft/TypeScript/issues/50008#event-10782480964
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/50008
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/50008
Design NotesNotes from our design meetingshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Notes%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.