Title: Suggestion/feature request - enforce static properties/fields · Issue #21976 · microsoft/TypeScript · GitHub
Open Graph Title: Suggestion/feature request - enforce static properties/fields · Issue #21976 · microsoft/TypeScript
X Title: Suggestion/feature request - enforce static properties/fields · Issue #21976 · microsoft/TypeScript
Description: I added this question on SO: is there a way to enforce static class properties? https://stackoverflow.com/questions/48813814/enforce-static-member-in-class-using-enum It doesn't look like there is a way to do what I want to do, hence the...
Open Graph Description: I added this question on SO: is there a way to enforce static class properties? https://stackoverflow.com/questions/48813814/enforce-static-member-in-class-using-enum It doesn't look like there is ...
X Description: I added this question on SO: is there a way to enforce static class properties? https://stackoverflow.com/questions/48813814/enforce-static-member-in-class-using-enum It doesn't look like there...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/21976
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Suggestion/feature request - enforce static properties/fields ","articleBody":"I added this question on SO:\r\n\r\nis there a way to enforce static class properties? https://stackoverflow.com/questions/48813814/enforce-static-member-in-class-using-enum\r\n\r\nIt doesn't look like there is a way to do what I want to do, hence the feature request.\r\n\r\n**Code**\r\n\r\n```ts\r\n\r\ndeclare enum Foods {\r\n CHERRY = 'CHERRY',\r\n LETTUCE = 'LETTUCE',\r\n JERKY = 'JERKY'\r\n}\r\n\r\ndeclare abstract class ForceFoods {\r\n static food : Foods\r\n}\r\n\r\nexport class MyFoods implements ForceFoods {\r\n static food = Foods.CHERRY; // if I omit this line, tsc will not complain\r\n}\r\n\r\n```\r\n\r\n**Expected behavior:**\r\nI was hoping tsc could enforce static properties to be defined\r\n\r\n**Actual behavior:**\r\nI don't currently believe tsc can enforce static properties\r\n\r\n\r\n","author":{"url":"https://github.com/ORESoftware","@type":"Person","name":"ORESoftware"},"datePublished":"2018-02-15T20:15:23Z","url":"https://github.com/microsoft/TypeScript/issues/21976"}
| 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:68ee986e-65e6-2a21-f085-796a8ca91592 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B30E:1739C:1F5B15:29BCFF:6B04B42B |
| html-safe-nonce | a6bd9bbc9c06784b5bad0d3dcc2fe0514e85f69d6916ffd363d9017ac6b3072e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzBFOjE3MzlDOjFGNUIxNToyOUJDRkY6NkIwNEI0MkIiLCJ2aXNpdG9yX2lkIjoiMjU1NzAyNTcyOTQxMDAyMDM5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9278d06da1aa049f9f60ef6555331dc0ad3a799fa77afac4efe31cbc7d19f088 |
| hovercard-subject-tag | issue:297582049 |
| 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/21976/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8e770f493290e447f4356290b726bde535ab4436949c9e06e8a63af082a2819f/microsoft/TypeScript/issues/21976 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8e770f493290e447f4356290b726bde535ab4436949c9e06e8a63af082a2819f/microsoft/TypeScript/issues/21976 |
| og:image:alt | I added this question on SO: is there a way to enforce static class properties? https://stackoverflow.com/questions/48813814/enforce-static-member-in-class-using-enum It doesn't look like there is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ORESoftware |
| hostname | github.com |
| expected-hostname | github.com |
| None | 378bd702ac792b3550e484ad39d9a898fcd25bb52ba6962b0c9cc457c1ea71c7 |
| 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 | b032e77f1ea437ede6c115446a0a467709b468e7 |
| 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