Title: Enforce definite initialization of `static` members · Issue #27899 · microsoft/TypeScript · GitHub
Open Graph Title: Enforce definite initialization of `static` members · Issue #27899 · microsoft/TypeScript
X Title: Enforce definite initialization of `static` members · Issue #27899 · microsoft/TypeScript
Description: Is there some clever reason why TSC can't check this (maybe... related to semantics of JS inheritance?)? TypeScript Version: 3.2.0-dev.20181011 Search Terms: strictPropertyInitialization, static, initialized, uninitialized, assigned, pro...
Open Graph Description: Is there some clever reason why TSC can't check this (maybe... related to semantics of JS inheritance?)? TypeScript Version: 3.2.0-dev.20181011 Search Terms: strictPropertyInitialization, static, i...
X Description: Is there some clever reason why TSC can't check this (maybe... related to semantics of JS inheritance?)? TypeScript Version: 3.2.0-dev.20181011 Search Terms: strictPropertyInitialization, stati...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/27899
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enforce definite initialization of `static` members","articleBody":"Is there some clever reason why TSC can't check this (maybe... related to semantics of JS inheritance?)?\r\n\r\n**TypeScript Version:** 3.2.0-dev.20181011\r\n\r\n**Search Terms:** strictPropertyInitialization, static, initialized, uninitialized, assigned, property\r\n\r\n**Code**\r\n\r\n```ts\r\nclass A {\r\n static s: number\r\n a() {\r\n A.s * 3 // Should be a compile error\r\n }\r\n}\r\nA.s * 7 // Should be an compile error\r\n```\r\n\r\n**Expected behavior:** Both lines should produce compile errors.\r\n\r\n**Actual behavior:** Both lines result in runtime exceptions.\r\n\r\n[**Playground Link**](https://www.typescriptlang.org/play/index.html#src=class%20A%20%7B%0D%0A%20%20static%20s%3A%20number%0D%0A%20%20a()%20%7B%0D%0A%20%20%20%20A.s%20*%203%20%2F%2F%20Should%20be%20a%20compile%20error%0D%0A%20%20%7D%0D%0A%7D%0D%0AA.s%20*%207%20%2F%2F%20Should%20be%20an%20compile%20error)\r\n\r\n**Related Issues:**\r\n\r\n- https://github.com/Microsoft/TypeScript/issues/21976\r\n","author":{"url":"https://github.com/bcherny","@type":"Person","name":"bcherny"},"datePublished":"2018-10-15T01:25:23Z","url":"https://github.com/microsoft/TypeScript/issues/27899"}
| 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:68fd37b6-2c15-4216-d386-850d447ce236 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D65E:18ADFF:64B9EE:880E4A:6B04A21F |
| html-safe-nonce | d18125d0b734270046560fa03140bee857468d411f72bea5813535ae015b7fa8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjVFOjE4QURGRjo2NEI5RUU6ODgwRTRBOjZCMDRBMjFGIiwidmlzaXRvcl9pZCI6IjU2MDA3NDg1MTM4MjgwNTM1MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cae336ef063460fa703c3d0cb91146d4e7aa4dfd72c35fcc055c8a10807decf6 |
| hovercard-subject-tag | issue:369966750 |
| 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/27899/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d5a46f1b7094853e8b50c8df9ecbd8a1c96c585e608b25ea8c9570b48dc3b112/microsoft/TypeScript/issues/27899 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d5a46f1b7094853e8b50c8df9ecbd8a1c96c585e608b25ea8c9570b48dc3b112/microsoft/TypeScript/issues/27899 |
| og:image:alt | Is there some clever reason why TSC can't check this (maybe... related to semantics of JS inheritance?)? TypeScript Version: 3.2.0-dev.20181011 Search Terms: strictPropertyInitialization, static, i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bcherny |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9784b6f42e2d5eac4e394fa88cad134c0dc5b6662b4ff2787a1ed1ef5a96331d |
| 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 | 3fd14143b75b2af7b76bbd23b069867d091adfcc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width