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
In the example below, if we just specify bound=FactoryBase on the _FactoryBase typevar, mypy gives error: Argument 1 to "make" of "FactoryBase" has incompatible type "int"; expected "T".
The recommended method for writing a factory method is to type the
cls
argument asType[T]
(http://mypy.readthedocs.io/en/latest/generics.html#generic-methods-and-generic-self). However, this doesn't seem to be able to handle the case where the factory class itself is generic.In the example below, if we just specify
bound=FactoryBase
on the_FactoryBase
typevar, mypy giveserror: Argument 1 to "make" of "FactoryBase" has incompatible type "int"; expected "T"
.The text was updated successfully, but these errors were encountered: