You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Check generic types when using ViewChild/ContentChild and through DI #43253
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 following definition:
@Component({/*...*/})exportclassNgxOptions<T>{
@Input()options: T[];}
@Component({/*...*/})exportclassNgxOption<T>{
@Input()display: (option: T)=>string;// Forced parent component to be of the same generic typeconstructor(options: NgxOptions<T>){}}
<ngx-options[options]="options"><!-- I'd expect the compiler and language service to enforce both components have the same generic type --><ngx-option[display]="displayOption"></ngx-option></ngx-options>
Proposed solution
It 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
Alternatives considered
Right 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.
Reacted by Enea Jahollari, Front-end developer, Harpush, Rafael Santana, Tobias Wittwer, Samuel Fernández, Mike Matuszak, AwesomeObserver, C /, Pavel Shurygin and 15 more
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.
You can find more details about the feature request process in our documentation.
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
Activity
angular-robot commentedon Sep 3, 2021
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.
You can find more details about the feature request process in our documentation.
angular-robot commentedon Oct 13, 2021
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
angular-robot commentedon Nov 19, 2021
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
Harpush commentedon Dec 30, 2021
This will be awesome! Correct me if I am wrong but that will allow typing context variables on content child template too. A very much needed feature
alxhub commentedon Feb 1, 2022
This has always been on the list for template type-checking.
angular-robot commentedon Feb 1, 2022
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
samuelfernandez commentedon Dec 26, 2022
@alxhub Any update on this? I can try to submit a PR provided with some hints
Harpush commentedon Mar 26, 2024
Can it be done with the new signal queries?
samuelfernandez commentedon Mar 26, 2024
The new API for signals does not add any changes regarding this issue, namely, strict typing in DI
Harpush commentedon May 19, 2024
@alxhub Any news concerning this? I am really waiting for this feature