-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed as not planned
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
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
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug