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
Is your feature request related to a problem?
Currently, if I inherit a custom textmap.Getter or textmap.Setter, I can't properly type hint it. For example, take this class:
main.py:6: error: Argument 1 of "get" is incompatible with supertype "Getter"; supertype defines the argument type as "CarrierT"
main.py:6: note: This violates the Liskov substitution principle
main.py:6: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
If I try to type hint carrier with the CarrierT TypeVar:
main.py:9: error: Value of type "CarrierT" is not indexable
Found 1 error in 1 file (checked 1 source file)
Describe the solution you'd like
Could Getter and Setter should be marked / inherit from Generic[CarrierT], so the specific TCarrier type can be defined? Happy to contribute a PR.
Describe alternatives you've considered
N/A
Additional context
Note: I see from #1690 that this could be somewhat more complicated. Specifically #1690 (comment)
The text was updated successfully, but these errors were encountered:
Note: I see from #1690 that this could be somewhat more complicated. Specifically #1690 (comment)
Thanks for digging into the previous discussions 🙂 it was difficult but might be worth giving it another shot. I would be happy to review a PR for this!
Is your feature request related to a problem?
Currently, if I inherit a custom
textmap.Getter
ortextmap.Setter
, I can't properly type hint it. For example, take this class:When checked with
mypy==0.920
:If I try to type hint
carrier
with theCarrierT
TypeVar:Describe the solution you'd like
Could
Getter
andSetter
should be marked / inherit fromGeneric[CarrierT]
, so the specificTCarrier
type can be defined? Happy to contribute a PR.Describe alternatives you've considered
N/A
Additional context
Note: I see from #1690 that this could be somewhat more complicated. Specifically #1690 (comment)
The text was updated successfully, but these errors were encountered: