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
classA{publica: string;}interfaceB{[index: string]: A;}interfaceCextendsB{a;b;c;}letc: C;c.a.a// c.a of type A
but members of interface C has type any instead I was hoping I could get type A?
Notice I don't want to define directly:
letc: B;
because I need to pass C as a type with defined props.
The text was updated successfully, but these errors were encountered:
tinganho
changed the title
No contextual typings for interfaces that extends interface with index signature
No contextual typing for interfaces that extends interface with index signature
Jul 10, 2015
Contextual typing applies to expressions, not declarations, so that part isn't exactly relevant.
It's legal to declare members of type any (which is what you've done) even when you have an index signature. I don't think we would take a breaking change here.
Having to repeat a type that I think could be inferred from a base interface. If not inferred maybe be able to reference the base signature value type?
Yes sort of related. Though this suggestion is an interface derived from an
interface/class. His suggestion where a class derived from a
interface/class.
I was hoping this could work:
but members of interface C has type
any
instead I was hoping I could get typeA
?Notice I don't want to define directly:
because I need to pass C as a type with defined props.
The text was updated successfully, but these errors were encountered: