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
// library function definitionfunctionlibFunction(id: string|number): void;functionlibFunction(conditions: {[key: string]: string}): void;functionlibFunction(idOrConditions: string|number|{[key: string]: string}): void{console.log(idOrConditions);}// working example that matches a single definitionfunctionmyWrapper(id: string|number){libFunction(id);}myWrapper("something");myWrapper(23)// working example casting the param to any// That's what I want to avoid// Our code base is strict and using `any` obriglate// me to use `eslint-disable` everywhere functionmyWrapperAny(idOrConditions: string|{[key: string]: string}){// eslint-disable-next-linelibFunction(idOrConditionsasany);}myWrapperAny("something");myWrapperAny({name: "John"});// non working wrapper// Even if there are overloads from both types// This just don't compile functionmyWrapper2(idOrConditions: string|{[key: string]: string}){libFunction(idOrConditions);}myWrapper2("something");myWrapper2({name: "John"});
π Actual behavior
No overload signature matches and code don't compile
π Expected behavior
Overload signature matches and code compile
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
overload inference union type
π Version & Regression Information
4.5.4
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
No overload signature matches and code don't compile
π Expected behavior
Overload signature matches and code compile
The text was updated successfully, but these errors were encountered: