Title: Design Meeting Notes, 4/21/2017 · Issue #15360 · microsoft/TypeScript · GitHub
Open Graph Title: Design Meeting Notes, 4/21/2017 · Issue #15360 · microsoft/TypeScript
X Title: Design Meeting Notes, 4/21/2017 · Issue #15360 · microsoft/TypeScript
Description: Check non-optional properties initialized in constructor (#8476) Why are we revisiting? The --strict flag makes it easier to surface these highly specific checks. Ideas Ensure that values are initialized at every point of exit in the con...
Open Graph Description: Check non-optional properties initialized in constructor (#8476) Why are we revisiting? The --strict flag makes it easier to surface these highly specific checks. Ideas Ensure that values are initi...
X Description: Check non-optional properties initialized in constructor (#8476) Why are we revisiting? The --strict flag makes it easier to surface these highly specific checks. Ideas Ensure that values are initi...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/15360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 4/21/2017","articleBody":"# Check non-optional properties initialized in constructor (#8476)\r\n\r\n* Why are we revisiting?\r\n * The `--strict` flag makes it easier to surface these highly specific checks.\r\n* Ideas\r\n * Ensure that values are initialized at every point of exit in the constructor body.\r\n * But this doesn't completely guarantee coverage for checks because of `super()` calls and virtual methods.\r\n * i.e. what if methods override and don't initialize appropriately?\r\n* But there's definitiely people bitten by this.\r\n* Not clear that this is the desirable behavior in `--strict`.\r\n * `--strict` is what we believe to be the the set of ideal settings for writing new code.\r\n * What makes this more desirable that `--noImplicitReturns`?\r\n * That was a toss-up as well.\r\n* What about Angular and the like? They wouldn't be able to use this flag.\r\n * Angular codebases (especially ones made by angular-cli) and the like should be explicit about their strictnesss options.\r\n * Or they could explicitly turn it off when upgrading projects.\r\n* Resolution: Let's do it, experiment\r\n\r\n# String enums (#3192)\r\n\r\n* Today, emulating string enums can be done with the following hack:\r\n\r\n```ts\r\nnamespace Color {\r\n export const None = undefined;\r\n export type None = undefined;\r\n\r\n export const Red: \"red\" = \"red\";\r\n export type Red = typeof Red;\r\n\r\n export const Green: \"green\" = \"green\";\r\n export type Green = typeof Green;\r\n\r\n export const Blue: \"blue\" = \"blue\";\r\n export type Blue = typeof Blue;\r\n}\r\n\r\ntype Color = Color.None | Color.Red | ...;\r\n```\r\n\r\n* Questions & ideas\r\n * Syntax\r\n * Would be great not to need another modifier on enums.\r\n * Should we produce a new type for each enum member?\r\n\r\n* Idea\r\n 1. Enum with non-literal members.\r\n 2. Enum with only numeric literal members.\r\n 3. Enum with only literal members, some of which are non-numeric.\r\n\r\n* Should each enum member widen?\r\n * Do they widen to `string` or to their base enum type?\r\n * Most people agree base enum type.\r\n\r\n* Reverse indexing?\r\n * Probably wouldn't be able to do that?\r\n\r\n* Question:\r\n * What happens when you have `Color.Red | Alert.Red` and they refer to the same literal type?\r\n\r\nOut of time.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2017-04-24T22:35:34Z","url":"https://github.com/microsoft/TypeScript/issues/15360"}
| 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:82c6963d-e5bb-790c-72ba-d12cd52b2f6b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC8C:1DB641:9DDD0E:CD2DA1:6B00E141 |
| html-safe-nonce | 2197090f65d3a84be68f7ab1eecb8a2335d007784714e999c06a68635a5d706a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzhDOjFEQjY0MTo5REREMEU6Q0QyREExOjZCMDBFMTQxIiwidmlzaXRvcl9pZCI6IjkwNzA5MzEzOTA0NTU0MDE2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 62bfad071e4ce1f6ef456f0257a488c3bada8305e5e961fc8fd0c116bec973eb |
| hovercard-subject-tag | issue:223970867 |
| 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/15360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5ec68b5930d3eddc88e8a5bdbf19e2a057d0f769b939933d4078365c881b2572/microsoft/TypeScript/issues/15360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5ec68b5930d3eddc88e8a5bdbf19e2a057d0f769b939933d4078365c881b2572/microsoft/TypeScript/issues/15360 |
| og:image:alt | Check non-optional properties initialized in constructor (#8476) Why are we revisiting? The --strict flag makes it easier to surface these highly specific checks. Ideas Ensure that values are initi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielRosenwasser |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width