According to the error message, a valid implementation signature is required:
Reference from the typescript documentation
For a practical example, visit this Stackblitz illustration:
function $sum(xor:string[]):string;
function $sum(xor:number[]):number;
function $sum(xor:Array<string | number>):number | string
{
/**
* as outlined in your overloads, the function should return
* - a string when receiving a string array input
* - a number when receiving a number array input
*
* To determine whether the input is a string array or a number array,
* you may check the type of the first item in the array
* e.g. typeof xor[0] === 'string'
*
* As mentioned by T.J.Crowder in a comment,
* handling an empty array poses a challenge: hence
* ensure that your function does not accept empty arrays and potentially throws an error
*/
}
The initial two lines represent the overloads while the third line represents the implementation signature.