Title: Support type-checking of computed properties for constants and Symbols · Issue #5579 · microsoft/TypeScript · GitHub
Open Graph Title: Support type-checking of computed properties for constants and Symbols · Issue #5579 · microsoft/TypeScript
X Title: Support type-checking of computed properties for constants and Symbols · Issue #5579 · microsoft/TypeScript
Description: On Angular we are considering using ES6 computed prototype methods as part of Angular’s component api but we realized that typescript doesn’t allow us to express this in a type-safe way. I’m wondering if this is a feature that could be a...
Open Graph Description: On Angular we are considering using ES6 computed prototype methods as part of Angular’s component api but we realized that typescript doesn’t allow us to express this in a type-safe way. I’m wonder...
X Description: On Angular we are considering using ES6 computed prototype methods as part of Angular’s component api but we realized that typescript doesn’t allow us to express this in a type-safe way. I’m wonder...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/5579
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support type-checking of computed properties for constants and Symbols","articleBody":"On Angular we are considering using ES6 computed prototype methods as part of Angular’s component api but we realized that typescript doesn’t allow us to express this in a type-safe way.\n\nI’m wondering if this is a feature that could be added to typescript or if there is a fundamental issue that would prevent typescript from supporting this. Example:\n\n```\n{Component, onInit, OnInit} from ‘angular2/core';\n\n@Component({\n selector: 'my-component'\n})\nclass MyComponent implements OnInit {\n [onInit](param1, param2){ return something; }\n}\n```\n\nWhere `onInit` is a const string or ES Symbol, and `OnInit` is an interface with the signature of the `[onInit]` method. `onInit` is a an optional life-cycle hook that Angular will call if the component has this property name.\n\nThe reason why we find this api style attractive is that it removes the possibility of name-collisions, which means that we are free to add support for more hooks in the future without affecting any existing components.\n\nPS: ES Observables are already using Symbols to define the observable interface, so this feature would allow creation of Observable interface. I expect more libs will want to take advantage of this api style as computed property and Symbol support becomes better.\n\nRelated issue: #4653\n","author":{"url":"https://github.com/IgorMinar","@type":"Person","name":"IgorMinar"},"datePublished":"2015-11-09T23:52:04Z","url":"https://github.com/microsoft/TypeScript/issues/5579"}
| 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:7e695cd1-f1f7-803b-a252-97e15851040d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84C4:3C21B:11503F6:163D9A4:6B01097B |
| html-safe-nonce | 983112ded60ec6bf955280d37d3a5e89585faa12f73700e0831758a33ad56e88 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEM0OjNDMjFCOjExNTAzRjY6MTYzRDlBNDo2QjAxMDk3QiIsInZpc2l0b3JfaWQiOiIxODU3MjA1MTQ1NDczOTc2NzAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8eea4b49398fb465dd1904c98b75031a8a5810a61a7f53850866796bb3e6698b |
| hovercard-subject-tag | issue:115994355 |
| 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/5579/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6ba58e2a345dbb8815485c6ae215766e3d6298672a8880fcb20f471defaf7075/microsoft/TypeScript/issues/5579 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6ba58e2a345dbb8815485c6ae215766e3d6298672a8880fcb20f471defaf7075/microsoft/TypeScript/issues/5579 |
| og:image:alt | On Angular we are considering using ES6 computed prototype methods as part of Angular’s component api but we realized that typescript doesn’t allow us to express this in a type-safe way. I’m wonder... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IgorMinar |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width