Two functions that are actually compatible, why does TypeScript report that "there is no compatible call signature"?

I have implemented a scaled-down version of EventTarget :

.
function test(foo: MyEventTarget | EventTarget) {
    if (foo instanceof EventTarget) {
        return foo.addEventListener("click", console.log);
    }
    else {
        return foo.addEventListener("click", console.log);
    }
}
// OK

but it"s so ugly.

so let me ask you:

  1. Is it a feature, or a bug?
  2. how should situations like feature or bug, be handled gracefully?
Mar.23,2021

this is a bug , which has not been resolved yet.

separate processing is also a solution, or through inheritance:

interface MyEventTarget extends EventTarget {
    addEventListener(
        type: string,
        listener: EventListener | EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions
    ): void
}

function test(foo: MyEventTarget) {
    return foo.addEventListener('click', console.log);
}
Menu