Why isn't this wrapper function picking up function overloads (typescript)?

Max*_*ber 5 types typescript

Why am I getting this error (on the last line)?

declare function f0<A, B>(a: A, b: B): string
declare function f0<A>(a: A): boolean;

declare function wrap
    <Ret, A>(f: (a: A) => Ret): (a: A) => Ret[]
declare function wrap
    <Ret, A, B>(f: (a: A, b: B) => Ret): (a: A, b: B) => Ret[]

const f1 = wrap(f0)
const b1: boolean[] = f1(1)
const s1: string[] = f1(1, 2) // Error: expected 1 arguments but got 2
Run Code Online (Sandbox Code Playgroud)

It seems the wrapper function is losing the information about f0's function overload.

I know this kind of wrapping (without losing type information) is possible, since Node's util.promisfy is typed correctly, but ~~I can't tell the difference between what I'm doing and what util.promisify does.~~

Update: The trick Node's util.promisify uses is to have a CustomPromisify type parameter:

export interface CustomPromisify<TCustom extends Function> extends Function {
    __promisify__: TCustom;
}
Run Code Online (Sandbox Code Playgroud)

Node standard library functions hook into it like this:

export namespace readFile {
    ...
    export function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise<Buffer>;
}
Run Code Online (Sandbox Code Playgroud)

Maybe what I'm looking for is only possible if I plug in to the same secret sauce that Node's `util.promisfiy