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
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}
The text was updated successfully, but these errors were encountered:
Hi,
Type narrowing not working in the following situation (maybe caused by generic type?):
The text was updated successfully, but these errors were encountered: