Closed as not planned
Description
π Search Terms
method function overload interface intheritance
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about overload
β― Playground Link
π» Code
interface I {
fn(str: "a"): void;
fn(str: "b"): void;
}
class C implements I {
fn(str: string): void {}
}
declare const c: C;
c.fn
// ^?
// Should be (str: "a"): void with +1 overload
π Actual behavior
Both signatures for fn
declared in I
should be inherited by C
, and the generic implementation that takes str: string
should not be considered the primary signature. Instead, the signatures fn(str: "a"): void
and fn(str: "b"): void
should come from the interface.
This would also make sense when implementing several interfaces with different signatures for the same function, you wouldn't only want to get the merged function in the end there.
π Expected behavior
see above.
Additional information about the issue
No response