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 protocol_without_converter should be inferred as Protocol[str, str]
Actual Behavior
main.py:49: error: Argument 1 to "Protocol" has incompatible type "Serializer[str]"; expected "Serializer[<nothing>]" [arg-type]
main.py:50: note: Revealed type is "__main__.Protocol[DTOPacketT`-1, DTOPacketT`-1]"
EDIT: A workaround to get this to work is to do the following:
Bug Report
It is not possible to infer the type of a
TypeVar
declared in aGeneric
with anotherTypeVar
in__init__
by adding a type hint toself
.To Reproduce
There is a mypy-play available here:
https://mypy-play.net/?mypy=latest&python=3.11&gist=282865693449e3786dde94d2f45bfb30
Expected Behavior
protocol_without_converter
should be inferred asProtocol[str, str]
Actual Behavior
EDIT: A workaround to get this to work is to do the following:
Mypy playground: https://mypy-play.net/?mypy=latest&python=3.11&gist=77ee74bfd5e80a91e3c0ff654a502d1f
Your Environment
mypy.ini
(and other config files): (none)The text was updated successfully, but these errors were encountered: