With v17.2, when I use the new signal queries like viewChild(), I can access the ElementRef with :
matCardElt = viewChild(MatCard, { read: ElementRef });
But this returns a Signal<ElementRef<any> | undefined> instead of Signal<ElementRef<MatCard> | undefined>
How can I enforce the right generic for ElementRef, so I can get a <ElementRef<MatCard> ?
This is currently a known limitation of the signal queries (
injecthas the same issue)To returned the right generic type, you need to specify it yourself.
The signal query is defined as
You need to specify
LocatorTandReadT, so in our case this would be: