Title: Design Meeting Notes, 07/22/2016 · Issue #9935 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 07/22/2016 · Issue #9935 · microsoft/TypeScript
X Title: Design Meeting Notes, 07/22/2016 · Issue #9935 · microsoft/TypeScript
Description: #9407 Number / enum / boolean literals New concept: Unit type A type with a single value (e.g. null, undefined, true) e.g. Boolean is a union of the two unit types true and false e.g. enums are unions of their constituent unit types corr...
Open Graph Description: #9407 Number / enum / boolean literals New concept: Unit type A type with a single value (e.g. null, undefined, true) e.g. Boolean is a union of the two unit types true and false e.g. enums are uni...
X Description: #9407 Number / enum / boolean literals New concept: Unit type A type with a single value (e.g. null, undefined, true) e.g. Boolean is a union of the two unit types true and false e.g. enums are uni...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9935
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 07/22/2016","articleBody":"- #9407 Number / enum / boolean literals\n - New concept: Unit type\n - A type with a single value (e.g. `null`, `undefined`, `true`)\n - e.g. Boolean is a union of the two unit types `true` and `false`\n - e.g. enums are unions of their constituent unit types corresponding to each member\n - Literal types are subtypes of their respective primitives, of course\n - When do we treat a string literal as its literal type vs its string type?\n - _Literal type locations_\n - An operand of an equality operator is a literal type location\n - As are `case` labels\n - Basically same rules as contextual typing in terms of flow\n - A location is a literal type location when assigning or comparing to a literal type\n - Old behavior: `===` operator would narrow based on `null` / `undefined`\n - New behavior: Narrowing works on constituents of unions of literal types\n - Bidirectional, e.g. `string | boolean === string | number` produces `string` for both operands\n - Control analysis works on unit types in `switch` blocks\n - Understands `case` fall-through\n - Can narrow down to `never` for exhaustiveness\n - Fun things now possible\n - `{ hasValue: true; value: string } | { hasValue: false }` instead of `{ hasValue: boolean; value?: string }`\n - Narrowing now applies to discriminator properties of unions\n - Removes many type assertions in the compiler\n - Inference of flag-like enums based on initializer expressions\n - No narrowing or unit types for enums that look like flags\n - Possible confusion since e.g. `enum X { a = 1 \u003c\u003c 0, b = 1 \u003c\u003c 1 }` different from `enum X { a = 1, b = 2}`\n - Open question: How to represent functions with side effects over locals\n - PR includes perf work\n - Shortcut: return early when checking `T` assignable to `U` when `T` is a constituent of `U` by object identity\n - Reduce closure allocations in isTypeRelatedTo\n - Remove O(n^2) duplicate removal algorithm\n - Be smarter about subtype reduction during union type construction -- do this rarely, not eagerly!\n - Union types are now ordered by ID to guarantee correct type identity when re-merging union types\n - Which release should this go into?\n - `master`, review feedback, then possibly 2.0 branch\n - Port perf fixes to 2.0 for sure\n","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2016-07-25T19:38:46Z","url":"https://github.com/microsoft/TypeScript/issues/9935"}
| 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:43768227-93f8-b315-756e-4258b36bd241 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA1E:1EC692:E3894D:1396463:6AFBF064 |
| html-safe-nonce | 1dc73647117d12ae70e4fe4697d5df760dcc7ab8aa2b83eb8b0173bd81fd6859 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTFFOjFFQzY5MjpFMzg5NEQ6MTM5NjQ2Mzo2QUZCRjA2NCIsInZpc2l0b3JfaWQiOiI2NTE3NjI2MTcwNjkzNjQ0Mzg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 355363afbcacd43a311a9f467fffc69d16e7b6f60d5d1eefc0c1721dfd865456 |
| hovercard-subject-tag | issue:167447915 |
| 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/9935/issue_layout |
| twitter:image | https://opengraph.githubassets.com/41367d0be6b20270ecbe925ae3b4382c43280ce0a4f8bf0c5a531c79901e3dfe/microsoft/TypeScript/issues/9935 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41367d0be6b20270ecbe925ae3b4382c43280ce0a4f8bf0c5a531c79901e3dfe/microsoft/TypeScript/issues/9935 |
| og:image:alt | #9407 Number / enum / boolean literals New concept: Unit type A type with a single value (e.g. null, undefined, true) e.g. Boolean is a union of the two unit types true and false e.g. enums are uni... |
| 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 | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| 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 | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width