type Combinable =string|number;functionadd(a:number, b:number):numberfunctionadd(a:string, b:string):stringfunctionadd(a:string, b:number):stringfunctionadd(a:number, b:string):stringfunctionadd(a: Combinable, b: Combinable){if(typeof a ==="string"||typeof b ==="string"){return a.toString()+ b.toString()}return a + b
}console.log(add(5,5))// 10console.log(add("a","b"))// abconsole.log(add("a",5))// a5console.log(add(5,"b"))// 5b