functionadd(a:any, b:any) {if (typeof a ==='number'&&typeof b ==='number') {return a + b; }if (typeof a ==='string'&&typeof b ==='string') {return a.concat(b); }thrownewError('Parameters must be numbers or strings');}returnadd(true,false);
functionadd(a:number|string, b:number|string) {if (typeof a ==='number'&&typeof b ==='number') {return a + b; }if (typeof a ==='string'&&typeof b ==='string') {return a.concat(b); }thrownewError('Parameters must be numbers or strings');}returnadd('a','b');