0
function handleArr(item: IUserInfo) 
function handleArr(item: IGoods | IUserInfo) {
  // do something different for IUserInfo or IGoods
}

I want to use funtion overloads for different params in above problems. Is there a property method for me to distinguish IGoods and IUserInfo

steady
  • 1
  • Given TS does not exist in runtime - you must do it yourself somehow based on unique properties of either of those types. – zerkms Aug 01 '20 at 07:59
  • 2
    Does this answer your question? [Is there a way to do method overloading in TypeScript?](https://stackoverflow.com/questions/12688275/is-there-a-way-to-do-method-overloading-in-typescript) – SRIDHARAN Aug 01 '20 at 08:13

0 Answers0