type Combinable = string | number; // Create a custom type
function add(a: Combinable, b: Combinable) {
if (typeof a === 'string' || typeof b === 'string') {
// concatenate the strings
return a.toString() + b.toString();
}
// add the numbers
return a + b;
}