Closed
Description
The second class definition fails type-checking with Invalid type "mymodule.T"
:
T = TypeVar('T')
class MyAbstractGeneric(Generic[T]):
pass
class MyGeneric(MyAbstractGeneric[T]):
pass
There's no documentation on creating custom abstract generic classes, and mypy and the typing tests have no examples of this either. The most obvious examples are those in typing
itself, but it apparently uses techniques that are off limits outside of typing
. I would love to know how to use multiple levels of inheritance to build up custom generics.
This is related to #606 but I did not want to derail the discussion there as my issue is more focused on creating generics rather than aliasing them. Maybe just user error.