You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior:
Matching method overload is selected.
Actual behavior:
The method is inferred to be a property if subclasses have a different signature.
The text was updated successfully, but these errors were encountered:
panthus
changed the title
Wrong type inferrance for inheritance and method overrides
Method inferred as property for inheritance and method overrides
Oct 12, 2016
Seems working as intended. It's unsafe to elevate those, because ((a: Cat) => void) | ((a: Dog) => void) are two incompatible types. If x is in fact a Cat, you would want x.getA(dog) to be a compile-time error, and similarly, if x is a Dog, you'd expect the same with x.getA(cat). The function incompatibility is why you need to narrow it first (there's no overload here because the types don't intersect).
TypeScript Version: 2.0.3
Code
Expected behavior:
Matching method overload is selected.
Actual behavior:
The method is inferred to be a property if subclasses have a different signature.
The text was updated successfully, but these errors were encountered: