Title: Check generic types when using `ViewChild`/`ContentChild` and through DI · Issue #43253 · angular/angular · GitHub
Open Graph Title: Check generic types when using `ViewChild`/`ContentChild` and through DI · Issue #43253 · angular/angular
X Title: Check generic types when using `ViewChild`/`ContentChild` and through DI · Issue #43253 · angular/angular
Description: Which @angular/* package(s) are relevant/releated to the feature request? compiler Description Imagine we have a parent component NgxOptions
Open Graph Description: Which @angular/* package(s) are relevant/releated to the feature request? compiler Description Imagine we have a parent component NgxOptions
X Description: Which @angular/* package(s) are relevant/releated to the feature request? compiler Description Imagine we have a parent component NgxOptions<T> and a child NgxOption<T>, with the follow...
Opengraph URL: https://github.com/angular/angular/issues/43253
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Check generic types when using `ViewChild`/`ContentChild` and through DI","articleBody":"### Which @angular/* package(s) are relevant/releated to the feature request?\n\ncompiler\n\n### Description\n\nImagine we have a parent component `NgxOptions\u003cT>` and a child `NgxOption\u003cT>`, with the following definition:\r\n\r\n```ts\r\n@Component({ /*...*/ })\r\nexport class NgxOptions\u003cT> {\r\n @Input() options: T[];\r\n}\r\n\r\n@Component({ /*...*/ })\r\nexport class NgxOption\u003cT> {\r\n @Input() display: (option: T) => string;\r\n\r\n // Forced parent component to be of the same generic type\r\n constructor(options: NgxOptions\u003cT>) { }\r\n}\r\n```\r\n\r\n```html\r\n\u003cngx-options [options]=\"options\">\r\n \u003c!-- I'd expect the compiler and language service to enforce both components have the same generic type -->\r\n \u003cngx-option [display]=\"displayOption\">\u003c/ngx-option>\r\n\u003c/ngx-options>\r\n```\r\n\r\n\n\n### Proposed solution\n\nIt would be great to enforce type checking of components with a generic type when there is a relationship between them, such as `ViewChild`/`ContentChild` or injection\n\n### Alternatives considered\n\nRight now the strict checking only applied to templates. However, it is only implemented for inputs/outputs, not for generic types in components when they are related.","author":{"url":"https://github.com/samuelfernandez","@type":"Person","name":"samuelfernandez"},"datePublished":"2021-08-25T14:19:40Z","url":"https://github.com/angular/angular/issues/43253"}
| 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:bb487383-c270-8590-55a6-5256fda5aa45 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8AEE:2F4BD9:16A863C:1DE234D:6B0130BF |
| html-safe-nonce | be34a0ad15e2ba5e0c9ad796f86df6c2c7e683618db66e3b8e1895eec204cb38 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUVFOjJGNEJEOToxNkE4NjNDOjFERTIzNEQ6NkIwMTMwQkYiLCJ2aXNpdG9yX2lkIjoiMTY1MzE1MTUzNzAwMzgzNTU4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 02e9cec1299be3346f13b4ede6ea6cd1fc0a1aab84e5277ef9b68e87358397aa |
| hovercard-subject-tag | issue:979205945 |
| 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/43253/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d8543faeeed44d023d51a929a9f99a1693c4a274feabe60a58e7212aec8a84dc/angular/angular/issues/43253 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d8543faeeed44d023d51a929a9f99a1693c4a274feabe60a58e7212aec8a84dc/angular/angular/issues/43253 |
| og:image:alt | Which @angular/* package(s) are relevant/releated to the feature request? compiler Description Imagine we have a parent component NgxOptions |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | samuelfernandez |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width