René's URL Explorer Experiment


Title: Design Meeting Notes, 1/6/2023 · Issue #52141 · microsoft/TypeScript · GitHub

Open Graph Title: Design Meeting Notes, 1/6/2023 · Issue #52141 · microsoft/TypeScript

X Title: Design Meeting Notes, 1/6/2023 · Issue #52141 · microsoft/TypeScript

Description: Stricter Relational Comparison Operators #52036 #52048 When narrowed to Promise, we reject comparisons with a number. We use the comparable relationship to determine if we can compare two types. It is optimistic and roughly checks if one...

Open Graph Description: Stricter Relational Comparison Operators #52036 #52048 When narrowed to Promise, we reject comparisons with a number. We use the comparable relationship to determine if we can compare two types. It...

X Description: Stricter Relational Comparison Operators #52036 #52048 When narrowed to Promise, we reject comparisons with a number. We use the comparable relationship to determine if we can compare two types. It...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 1/6/2023","articleBody":"# Stricter Relational Comparison Operators\r\n\r\nhttps://github.com/microsoft/TypeScript/issues/52036\r\nhttps://github.com/microsoft/TypeScript/pull/52048/\r\n\r\n* When narrowed to `Promise`, we reject comparisons with a `number`.\r\n* We use the comparable relationship to determine if we can compare two types. It is optimistic and roughly checks if one operand has overlap with the other - and allows a `Promise | number` to be compared with a `number`.\r\n* Recurring issue - discussed in the past\r\n    * https://github.com/microsoft/TypeScript/issues/5156\r\n    * https://github.com/microsoft/TypeScript/issues/10120\r\n* Is it meaningful to allow `\u003e=` when you have an object?\r\n    * Feels like it's questionable.\r\n* Can you get away with just restricting to `number`s and `bigint`s?\r\n    * `string`s!\r\n* \"We have to be more choosier when checking for overlappiness\"\r\n* Kind of want to figure out a strategy where we get the base primitive type of each operand and then check if they're assignable to `bigint | number`, or `string`, and both have overlap.\r\n    * Probably some subtlety - make sure to test with generics.\r\n\r\n\r\n# Improved Logic When Choosing Between Covariant and Contravariant Inferences\r\n\r\nhttps://github.com/microsoft/TypeScript/issues/52111#issuecomment-1372986298\r\nhttps://github.com/microsoft/TypeScript/pull/52123\r\n\r\n```ts\r\ninterface A { a: string }\r\ninterface B extends A { b: string }\r\ninterface C extends A { c: string }\r\n\r\ndeclare function cast\u003cT, U extends T\u003e(x: T, test: (x: T) =\u003e x is U): U;\r\n\r\ndeclare function isC(x: A): x is C;\r\n\r\nfunction f1(a: A, b: B) {\r\n    const x1 = cast(a, isC);  // cast\u003cA, C\u003e\r\n    const x2 = cast(b, isC);  // cast\u003cA, C\u003e\r\n    //                 ~~~\r\n    // Argument of type '(x: A) =\u003e x is C' is not assignable to parameter of type '(x: B) =\u003e x is B'.\r\n    //   Type predicate 'x is C' is not assignable to 'x is B'.\r\n    //     Property 'b' is missing in type 'C' but required in type 'B'.\r\n}\r\n```\r\n\r\n* When doing type argument inference, we separate covariant inference sites from contravariant inference sites.\r\n    * When deciding on what to infer, we use these to prioritize.\r\n    * We try to pick covariant inferences, and by default construct a type from covariant inference candidates.\r\n        * We *do not* use this type constructed by covariant inferences if:\r\n            * the constructed type is `never`, or\r\n            * it's not a subtype of *any* contravariant inference candidate.\r\n        * *\\[Editor's Note]: The intuition here is that a contravariant inference site places a hard expectation on what it can be given; if that fails, using the contravariant inference will provide a better error message.*\r\n    * #52123 added *another* exception here where we *do not* do this when the type parameter is used as a constraint of another type parameter *and* for that constrained type parameter, its covariant inference candidates the constructed covariant type of its constraint (i.e. the original type parameter).\r\n    * So now in the assignment to `x2`, we choose the type `A` instead of `C` because `T` is used as the constraint of `U`, and the candidate of `A` would not have been assignable to \r\n* When a covariant inference is a subtype of the contravariant inference, you have a range of types you can choose from.\r\n* Doesn't solve all possible variations of this - doesn't fix the case of arbitrarily nested generic constraints.\r\n\r\n# Varying Subtype Reduction Depending on Declaration Order\r\n\r\nhttps://github.com/microsoft/TypeScript/issues/52100\r\n\r\n```ts\r\ndeclare let u: Promise\u003cunknown\u003e\r\ndeclare let a: Promise\u003cany\u003e\r\n\r\n// Assigned an expression that is Promise\u003cany\u003e | Promise\u003cunknown\u003e\r\n// but that will undergo subtype reduction\r\n// The type of union depends on whether a or u was declared first\r\nlet union =\r\n//  ^?\r\n// Varies between 'Promise\u003cany\u003e' and 'Promise\u003cunknown\u003e'.\r\n    Math.random() \u003e 0.5\r\n        ? Promise.reject\u003cany\u003e()\r\n        : Promise.reject\u003cunknown\u003e();\r\n\r\nunion.then(v =\u003e v.toString());\r\n```\r\n\r\n* These differ by type ID based on where they're declared in the file and get sorted in an initial union type.\r\n* When we try to reduce the union, whichever came first \"wins\" because `any` and `unknown` are both (non-strict) subtypes of each other.\r\n* Unclear if you'd want `unknown` or `any` to win out. Presumably first principles would indicate `unknown` because it's the safer one.\r\n* Don't really have any solution here. Many similar issues show up.\r\n\r\n# Monomorphism Recap - Runtime Speed vs. Memory Usage\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/51682\r\nhttps://github.com/microsoft/TypeScript/pull/51880  \r\n\r\n* We got some nice performance boosts from ensuring definite shapes on certain Nodes and Symbols - but it came at the expense of memory.\r\n* Feels like a good tradeoff in general.\r\n* We can start shrinking many of the types we have in the compiler - lots of optional boolean properties.\r\n    * But V8 allocates in chunks - so this work could be for nothing.\r\n    * Still buys us some wiggle room, more possibility to shrink down the line.\r\n* Can we just shrink down `Identifier` to 2 properties?\r\n    * 2 *additional* properties on top of `Node`.\r\n    * We can try.\r\n    * Get rid of `originalKeywordKind`\r\n    * Move `hasExtendedUnicodeEscape` to the containing source file, turn it into a slow path during emit.\r\n    * Move emit-related things into their own bucket.\r\n","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2023-01-07T18:07:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/52141/TypeScript/issues/52141"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:2a7f663b-fe90-e55f-7138-4fcc51789604
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBF40:EB829:1D3CE7:28E2A5:6A623147
html-safe-nonce3b8d8d5682d680919be01b7a6e588ebe2ac45c0f1ebe45723c4293b6303504d6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjQwOkVCODI5OjFEM0NFNzoyOEUyQTU6NkE2MjMxNDciLCJ2aXNpdG9yX2lkIjoiMzY1NDE2ODM5NDk0ODgxNzIyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac305367b522c3a0d0b72ddf2e0450d82b75a24d2c6da4efa3f9e35b398a2fc57c
hovercard-subject-tagissue:1524029201
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/52141/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ad39fb6e807e76b8971a8c6735db64cd221ba8d2b1c53e49f298cbd1808849c4/microsoft/TypeScript/issues/52141
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ad39fb6e807e76b8971a8c6735db64cd221ba8d2b1c53e49f298cbd1808849c4/microsoft/TypeScript/issues/52141
og:image:altStricter Relational Comparison Operators #52036 #52048 When narrowed to Promise, we reject comparisons with a number. We use the comparable relationship to determine if we can compare two types. It...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameDanielRosenwasser
hostnamegithub.com
expected-hostnamegithub.com
Nonef01037538d0c99e88fa8e01da1b1825ad354ff4da745198c7392a43592c8398c
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
release10b5a8861bf21b66a650f894089f8ce1476c1d49
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/52141#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F52141
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F52141
Sign up https://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/52141
Reloadhttps://github.com/microsoft/TypeScript/issues/52141
Reloadhttps://github.com/microsoft/TypeScript/issues/52141
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/52141
microsoft https://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Fork 13.6k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Star 110k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Code https://github.com/microsoft/TypeScript
Issues 5k+ https://github.com/microsoft/TypeScript/issues
Pull requests 21 https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality 0 https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Code https://github.com/microsoft/TypeScript
Issues https://github.com/microsoft/TypeScript/issues
Pull requests https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Design Meeting Notes, 1/6/2023https://github.com/microsoft/TypeScript/issues/52141#top
Design NotesNotes from our design meetingshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Notes%22
https://github.com/DanielRosenwasser
DanielRosenwasserhttps://github.com/DanielRosenwasser
on Jan 7, 2023https://github.com/microsoft/TypeScript/issues/52141#issue-1524029201
#52036https://github.com/microsoft/TypeScript/issues/52036
#52048https://github.com/microsoft/TypeScript/pull/52048
Should unions and non-primitives be allowed for relational comparisons? #5156https://github.com/microsoft/TypeScript/issues/5156
Proposal: Introduce a Relational Comparison Type Relationship #10120https://github.com/microsoft/TypeScript/issues/10120
#52111 (comment)https://github.com/microsoft/TypeScript/issues/52111#issuecomment-1372986298
#52123https://github.com/microsoft/TypeScript/pull/52123
Improve logic that chooses co- vs. contra-variant inferences #52123https://github.com/microsoft/TypeScript/pull/52123
#52100https://github.com/microsoft/TypeScript/issues/52100
#51682https://github.com/microsoft/TypeScript/pull/51682
#51880https://github.com/microsoft/TypeScript/pull/51880
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.