Title: AOT: add support for extending expressions in classes · Issue #13436 · angular/angular · GitHub
Open Graph Title: AOT: add support for extending expressions in classes · Issue #13436 · angular/angular
X Title: AOT: add support for extending expressions in classes · Issue #13436 · angular/angular
Description: I'm submitting a feature request [ ] bug report => search github for a similar issue or PR before submitting [X ] feature request [ ] support request => Please do not submit support request here, instead see https://github.com/angular/an...
Open Graph Description: I'm submitting a feature request [ ] bug report => search github for a similar issue or PR before submitting [X ] feature request [ ] support request => Please do not submit support request here, i...
X Description: I'm submitting a feature request [ ] bug report => search github for a similar issue or PR before submitting [X ] feature request [ ] support request => Please do not submit support reque...
Opengraph URL: https://github.com/angular/angular/issues/13436
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AOT: add support for extending expressions in classes","articleBody":"**I'm submitting a feature request**\r\n```\r\n[ ] bug report => search github for a similar issue or PR before submitting\r\n[X ] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nCurrently the AOT doesn't allow any functions to be within an annotation though this same rule applies to classes it seems. Meaning the following fully compatible typescript 1.6+ code, copied from the typescript What's new section (https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#extending-expressions), isn't allowed by the AOT:\r\n\r\n```javascript\r\nclass ThingA {\r\n getGreeting() { return \"Hello from A\"; }\r\n}\r\n\r\ninterface GreeterConstructor {\r\n new (): ThingA;\r\n}\r\n\r\nfunction getGreeterBase(): GreeterConstructor {\r\n return ThingA;\r\n}\r\n\r\nclass Test extends getGreeterBase() {\r\n sayHello() {\r\n console.log(this.getGreeting());\r\n }\r\n}\r\n```\r\n\r\nThe area were this has manifested for me is in the use of immutablejs'es `Record` class (https://facebook.github.io/immutable-js/docs/#/Record):\r\n\r\n```javascript\r\nexport class ModelA extends Record({name: ''}) {\r\n name: string\r\n}\r\n```\r\n\r\nWhich is something the AOT really doesn't like and throws an error on. \r\n\r\n**Expected behavior**\r\nI'm not sure if the above is by design (though based on the response I got on gitter it would seem so) and due to this fact it's a feature request and not a bug report. I would just like to know if it's by design or if there is a chance it will be altered, as it will influence the decisions I have to make going forwards when it comes to Ngrx/Store + ImmutableJS etc. \r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nThe main reason I would like this changed is that it would bring the AOT in line with the regular Typescript compiler. While I understand functions directly inside of an annotation isn't something you would want I find it weird that the AOT parts here from the Typescript standard (which isn't clearly documented anywhere as far as I can tell).\r\n\r\n* **Angular version:** 2.0.X\r\n2.3.0\r\n \r\n* **Language:** [all | TypeScript X.X | ES6/7 | ES5]\r\nTypescript 2.0.10\r\n\r\n* **Node (for AoT issues):** `node --version` = \r\n4.2.2","author":{"url":"https://github.com/nschipperbrainsmith","@type":"Person","name":"nschipperbrainsmith"},"datePublished":"2016-12-13T18:15:19Z","url":"https://github.com/angular/angular/issues/13436"}
| 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:a50c7301-6e8e-88c0-8751-12a948429be9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F02:3DF0BE:7CB23A:A3ACBF:6B00DAFB |
| html-safe-nonce | c1bb4f4d9c7cd2529226d1b9be7aa904dfd5b45ebacb121e70f5c7553c3c87a4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjAyOjNERjBCRTo3Q0IyM0E6QTNBQ0JGOjZCMDBEQUZCIiwidmlzaXRvcl9pZCI6IjI1NzUzNTg4NDg4NTIzNTE3MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f8e1d250d697569f91955689fbb072f70b519c9c3c8b2527f4455175547119b6 |
| hovercard-subject-tag | issue:195328235 |
| 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/angular/angular/13436/issue_layout |
| twitter:image | https://opengraph.githubassets.com/40d4fe7c29a680bb7bc84ab4a24f04bee84c5f5d064ea86bb70128bd40a1dd51/angular/angular/issues/13436 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/40d4fe7c29a680bb7bc84ab4a24f04bee84c5f5d064ea86bb70128bd40a1dd51/angular/angular/issues/13436 |
| og:image:alt | I'm submitting a feature request [ ] bug report => search github for a similar issue or PR before submitting [X ] feature request [ ] support request => Please do not submit support request here, i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nschipperbrainsmith |
| hostname | github.com |
| expected-hostname | github.com |
| None | a481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| 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 | 84c8c5cc25e2fb7f2308428458538436baecc6d2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width