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
In the meantime if you want typechecking by angular you can stop using *ngIf="... as x" syntax and use a sideeffect instead. Not very elegant, but at least type safe and checked by AngularCompilerPlugin and ngc.
as x syntax, value is type any
exportinterfaceMyModel{baz: number;}
@Component({selector: 'foo',template: `<div *ngIf="stream$|async as stream">{{ stream.bar }}</div>`})classFooComponent{stream$=of<MyModel>({baz: 1});}// no error reported, `stream` is `any`
sideeffect, value is type MyModel
exportinterfaceMyModel{baz: number;}
@Component({selector: 'foo',template: `<div *ngIf="stream$|async">{{ stream?.bar }}</div>`})exportclassFooComponent{stream$=of<MyModel>({baz: 1}).pipe(tap((value)=>this.stream=value));stream?: MyModel;}// Error: foo-component.ts.FooComponent.html(9,34): : Property 'bar' does not exist on type 'ProductListView'. Did you mean 'baz'?
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
[-]feat(common): support generics in NgIf context[/-][+]Support generics in NgIf context[/+]sod commentedon Jan 18, 2019
In the meantime if you want typechecking by angular you can stop using
*ngIf="... as x"syntax and use a sideeffect instead. Not very elegant, but at least type safe and checked by AngularCompilerPlugin and ngc.as xsyntax, value is type anysideeffect, value is type MyModel
sod commentedon Oct 19, 2019
This may come with angular9. Was this fixed by #33016?
angular-robot commentedon Jun 4, 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 Jun 27, 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.
alxhub commentedon Jul 17, 2021
This has been implemented!
angular-automatic-lock-bot commentedon Aug 17, 2021
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.