Hi,
Type narrowing not working in the following situation (maybe caused by generic type?):
interfaceOptions<T>{opt: T|(()=>T);}functionMyFunc<T>(options: Options<T>){varopt=options.opt;if(typeofopt==="function"){vark=opt;// k is "T | (() => T)" but should be "() => T"}}///////////////////////////////////varoptions: Options<number>;varopt=options.opt;if(typeofopt==="function"){vark=opt;// k is "() => number", it is OK}
Hi,
Type narrowing not working in the following situation (maybe caused by generic type?):