A single function can work on both one value and an array of values. Overloads let the return type match the input shape. Keep one implementation using a small Array.isArray check.
You will transform numbers with a provided function.
function inc(n: number) {
return n + 1;
}
Create an overloaded applyOrMap that applies a transform to a number or an array of numbers.