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
The first line compiles fine, but in the createHostFactory the line: host: HostComponent<Phone> provides an error (no overload matches this signature). If I add HostComponent sans <phone> then I receive an error when initialzing spectator with the createHost method as it was defined as type SpectatorHost<...,HostComponent<Phone>> and not <...,HostComponent<unknown>>
I also tried creating a new type: type phoneHost = HostComponent<Phone>;
In the createHost declaration, it told me that it received a type but needed a value.
Is there a recommended way to do this? Are generics in this context not supported? Any thoughts/help would be appreciated!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there a way to implement the
createHostFactory
method with a generic Host Component?I'm trying to create a generic component that I can reuse to host form controls that looks like this:
The idea being that I can reuse this host component to test a variety of components that implement Control Value Accessor.
I tried to implement it like this:
The first line compiles fine, but in the createHostFactory the line:
host: HostComponent<Phone>
provides an error (no overload matches this signature). If I add HostComponent sans<phone>
then I receive an error when initialzingspectator
with thecreateHost
method as it was defined as typeSpectatorHost<...,HostComponent<Phone>>
and not<...,HostComponent<unknown>>
I also tried creating a new type:
type phoneHost = HostComponent<Phone>;
In the createHost declaration, it told me that it received a type but needed a value.
Is there a recommended way to do this? Are generics in this context not supported? Any thoughts/help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions