Title: Introduce a way to enforce a static contract · Issue #1263 · microsoft/TypeScript · GitHub
Open Graph Title: Introduce a way to enforce a static contract · Issue #1263 · microsoft/TypeScript
X Title: Introduce a way to enforce a static contract · Issue #1263 · microsoft/TypeScript
Description: I'm building an application framework in javascript and just porting it over to typescript to use some of that sweet static typing. In my framework I happen to have a concept of a UI module. A UI module is a class and can be instantiated...
Open Graph Description: I'm building an application framework in javascript and just porting it over to typescript to use some of that sweet static typing. In my framework I happen to have a concept of a UI module. A UI m...
X Description: I'm building an application framework in javascript and just porting it over to typescript to use some of that sweet static typing. In my framework I happen to have a concept of a UI module. A ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/1263
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Introduce a way to enforce a static contract","articleBody":"I'm building an application framework in javascript and just porting it over to typescript to use some of that sweet static typing. In my framework I happen to have a concept of a UI module. A UI module is a class and can be instantiated many times in an application. All modules have static definitions of their nature like what events they can trigger and what internal models they make publicly available. The implementation of these modules is a application-implementaional part on a level above the framework codebase, but the framework needs to treat the modules polymorphically (non-instantiated) to read these definitions to set up the application engine accordingly.\n\nIf there was the possibility to define static fields in an interface this would take care of making this contract explicit and statically validated for the application developer. But we don't have that. I'm sure that this contract could be enforced by wrapping the module classes in some kind of factory pattern or other contraptions, but I'm honestly not very attracted to that.\n\nWouldn't it be neat if we can enforce a static contract in typescript, considering the dynamic nature of the underlying javascript where this kind of static type polymorphism isn't all that weird?\n","author":{"url":"https://github.com/Elephant-Vessel","@type":"Person","name":"Elephant-Vessel"},"datePublished":"2014-11-25T06:57:04Z","url":"https://github.com/microsoft/TypeScript/issues/1263"}
| 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:7fa0bf5a-c8c8-9314-97ee-68594934cb26 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9358:4279A:24C84FE:31830BF:6B01B0B9 |
| html-safe-nonce | 26e29ede8432c58d45f668a4267fdd9adfd3368aa2624693fff1f71ea2567965 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzU4OjQyNzlBOjI0Qzg0RkU6MzE4MzBCRjo2QjAxQjBCOSIsInZpc2l0b3JfaWQiOiI4OTIzNDE4MDk4MjkyMzM4ODczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ff9110b45f1f4c0d108ef74c3d591902ce634502b4b06d516e0401e7ba1265aa |
| hovercard-subject-tag | issue:49983101 |
| 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/1263/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6adeb0efa28f692010be2d996f7493c9ff478213d7e1864ee0e578902ff71c9c/microsoft/TypeScript/issues/1263 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6adeb0efa28f692010be2d996f7493c9ff478213d7e1864ee0e578902ff71c9c/microsoft/TypeScript/issues/1263 |
| og:image:alt | I'm building an application framework in javascript and just porting it over to typescript to use some of that sweet static typing. In my framework I happen to have a concept of a UI module. A UI m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Elephant-Vessel |
| 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