What key element am I overlooking?
type HandlerA = (firstArg: string) => number;
type HandlerB = (firstArg: string, secondArg: number) => string;
type Handler = HandlerA | HandlerB
// success
const testA: Handler = (a, b) => 'text'
// failure, as a is assumed to be of type 'any'
const testB: Handler = (a) => 10
Upon analysis, it becomes evident that testB cannot infer HandlerA. Is there an alternative approach to rectify this without explicitly defining like
const testC: Handler = (a: string) => 10