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

2
  • Given TS does not exist in runtime - you must do it yourself somehow based on unique properties of either of those types. Commented Aug 1, 2020 at 7:59
  • 2
    Does this answer your question? Is there a way to do method overloading in TypeScript? Commented Aug 1, 2020 at 8:13

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.