The example is with strict null checking. Consider I have the following function declaration:
declare function f(value: null, multiplier: number): null;
declare function f(value: string, multiplier: number): number;
declare function f(value: string | null, multiplier: number): number | null;
Now I want to carry it like this:
const f2 = (value) => f(value, 2);
Seems like the inferred parameter type is "any" and the inferred return type is "number | null".
Is there a way to make typescript infer the new function type correctly so it preserves overloads, without having to redefine all signatures?
The expected call signature results should be identical to this:
function f2(value: null): null;
function f2(value: string): number;