Title: Design Meeting Notes, 2/1/2023 · Issue #52579 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 2/1/2023 · Issue #52579 · microsoft/TypeScript
X Title: Design Meeting Notes, 2/1/2023 · Issue #52579 · microsoft/TypeScript
Description: Intersection state #52392 Unifies the interaction of excess property checking and weak types Key logic is in structuredTypeRelatedTo, dealing with properties which are nested in the intersection, e.g. { a: { x: string } } & { c: number }...
Open Graph Description: Intersection state #52392 Unifies the interaction of excess property checking and weak types Key logic is in structuredTypeRelatedTo, dealing with properties which are nested in the intersection, e...
X Description: Intersection state #52392 Unifies the interaction of excess property checking and weak types Key logic is in structuredTypeRelatedTo, dealing with properties which are nested in the intersection, e...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/52579
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 2/1/2023","articleBody":" * Intersection state #52392\r\n * Unifies the interaction of excess property checking and weak types\r\n * Key logic is in `structuredTypeRelatedTo`, dealing with properties which are nested in the intersection, e.g.\r\n * `{ a: { x: string } } & { c: number }` , we need to deal with both the intersection type and its final form\r\n * Contrast with something like `{ a: { x: string } } & { a: { y: number } }` - a contextual-agnostic analyis can't handle this correctly\r\n * Interacts with `isDeeplyNestedType`, which exists to prevent runaway stackoverflows in generatively-recursive types\r\n * The \"identity key\" here is, for example, the `symbol` of a declared type\r\n * For intersections, no such durable/reusable identity key existed\r\n * This meant we couldn't safely plumb to more than a fixed depth (1) of intersections when looking for excess properties\r\n * Fix: Instead, an intersection is deeply nested if any of its constituents is deeply nested\r\n * Now we don't need a fixed depth limit\r\n * Fix is good, everything's passing\r\n * Check time for `vuelidate` on DT has doubled, but really only because we're doing work we should have been doing the whole time\r\n * 5.0 or 5.1?\r\n * It's a bugfix, standard level of riskiness, 5.0.\r\n * Widening/nonwidening enum literals #52542\r\n * In 5.0 we unified `enum` logic, yay\r\n * Consider `enum E { A = 1, B = 2, C = 3}`\r\n * Type `E` is a union, `E.A | E.B | E.C`\r\n * Contrast `enum X { A = compute(0), B = compute(1), C = compute(2) }`\r\n * Old behavior: type `X` is just `X`, a subtype of `number`\r\n * New behavior: type `X` is a union of `X.A | X.B | X.C`, pretty much the same as `E`, each of which is an opaque subtype of number\r\n * All motivating scenarios that led to fresh/nonfresh widening/nonwidening literal types for string/numeric literals now apply to these opaque (nonliteral) types\r\n * e.g. `let a = E.A;`, `a = E.B;` should be legal\r\n * Declaration file emit allows for initializers so that you can get both behaviors despite the fresh and nonfresh types having identical names\r\n * 👉 5.0\r\n * `export` ordering (TC39 update)\r\n * Order 1: `@decorator export class X {`\r\n * Order 2: `export @decorator class X {`\r\n * Order 1 is the longstanding order in TS\r\n * Order 2 came into existence due to a transcription error when writing the proposal\r\n * Upon fixing the error, concerns were raised\r\n * What if you want to \"decorate an export\" ?\r\n * What does this mean?\r\n * Sort of unclear, all possible things you could do here violate critical static invariants\r\n * Various *arguments ad linguistics* of what's an adverb, adjective, conjunction junction what's your arrow function, etc.\r\n * What if you want to have different behaviors between Order 1 and Order 2?\r\n * But *what*?\r\n * At best, you could have the inner and outer names of a class refer to the undecorated / decorated values, but this is a footgun\r\n * *If desired* you can use proxies\r\n * If this is legal, then `@deco1 export @deco2 class A {` becomes legal and sensical (!)\r\n * TC39 Discussion continued for a long time without progress\r\n * Decorators went to stage 3 without this being addressed\r\n * Today\r\n * `export @decorator class` is legal per TC39\r\n * In 5.0 today:\r\n * In TS files, both orderings are supported with identical semantics\r\n * In JS files, only `export @decorator class` is supported under non-experimental-decorators\r\n * This has implications for `Function#toString` since decorators are supposed to be part of `toString` but not `export`\r\n * Arguments about `eval(someClass.toString())` but this is not an existing invariant anyway (?)\r\n * Do we need a transitional flag?\r\n * Quickfix? Tool? Regular expression?\r\n * These tools don't work on documentation on the internet\r\n * This is an argument for making the proposal change, not making the behavior available in TS when it doesn't actually exist\r\n * What are other transpilers doing?\r\n * If we allow this (illegal!) syntax, then every TS-compatible transpiler has to as well, and it's a de facto JS feature\r\n * But it's effectively moot since (all?) transpilers already presumably support `experimentalDecorators`\r\n * Babel issues a specific error\r\n * Conclusions:\r\n * Hope that both-orderings proposal goes through at TC39 and we don't have to make a tough decision\r\n * Otherwise, circle back and argue about allowing flagged, unflagged, or not at all\r\n * **Update 2/2/23**: Most of this turned out to be moot because both orderings were accepted at TC39 today 🎉\r\n","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2023-02-02T22:13:10Z","url":"https://github.com/microsoft/TypeScript/issues/52579"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:14f4cb10-4257-31a9-31d3-f7c725847a0c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A48E:34CAB:256762F:2FCDDD3:6B019732 |
| html-safe-nonce | 111fcc22fcf15eaacbdad3197c666e8b3965f859a516d628d7b98322832d7f9e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDhFOjM0Q0FCOjI1Njc2MkY6MkZDREREMzo2QjAxOTczMiIsInZpc2l0b3JfaWQiOiI4MDk4MDA2MTIwNzk2MzYyNTQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4ee94534e6691a0eb736fc7fa3eb1d9b14ffcbc2024e6266f7a2abd7e00be620 |
| hovercard-subject-tag | issue:1568863099 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/52579/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8eef585a1f96846b80054e4d1a1aed009e87f137eb10479ab6e5577a341016d2/microsoft/TypeScript/issues/52579 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8eef585a1f96846b80054e4d1a1aed009e87f137eb10479ab6e5577a341016d2/microsoft/TypeScript/issues/52579 |
| og:image:alt | Intersection state #52392 Unifies the interaction of excess property checking and weak types Key logic is in structuredTypeRelatedTo, dealing with properties which are nested in the intersection, e... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RyanCavanaugh |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width