TypeScript Version: 2.1.4
Code
functionmergeObject<Textendsany>(dst: T,src: T): T{for(varxinsrc){dst[x]=src[x];}returndst;}interfaceHash<T>{[key: string]: T;}typeEventHandler=(s: BaseEventDealer)=>void;interfaceBaseEventDealer{GetEventHandler(event: string): EventHandler;}classCimplementsBaseEventDealer{GetEventHandler(event: string){returnC.h[event];}statich : Hash<EventHandler>={a:function(s){}}}classDextendsC{GetEventHandler(event: string){returnD.h[event];}statich=mergeObject<Hash<EventHandler>>({b:function(s:D){}},C.h);}Expected behavior:
type of D.h should be Hash<EventHandler>
type of return value of D.GetEventHandler should be EventHandler
Actual behavior:
type of D.h and return value of D.GetEventHandler both is ImplicitAny
but if you remove D.GetEventHandler or change its name, h will get right type
or you manually declare h:Hash<EventHandler> or GetEventHandler(event: string):EventHandler, they will both get right type
TypeScript Version: 2.1.4
Code
Expected behavior:
type of D.h should be Hash<EventHandler>
type of return value of D.GetEventHandler should be EventHandler
Actual behavior:
type of D.h and return value of D.GetEventHandler both is ImplicitAny
but if you remove D.GetEventHandler or change its name, h will get right type
or you manually declare h:Hash<EventHandler> or GetEventHandler(event: string):EventHandler, they will both get right type