Open sobolevn opened 5 years ago
need to be retested - i think this should be resolved now @sobolevn
@Goldziher let's add a test for it as well! Because I still think that this is revelant: https://github.com/typeddjango/djangorestframework-stubs/blob/master/rest_framework-stubs/mixins.pyi#L10
It still has BaseSerializer
there.
I saw this same issue, and I believe the TypeVar
for BaseSerializer
needs to be created as covariant with covariant=True
. The TypeVar
for UsesQuerySet
is set up that way, so I think it was just something overlooked before.
I tried using serializer: BaseSerializer[MyModelType]
for the method override to try and fix the error, and I got another type error saying the generic type is invariant.
@w0rp PR is more than welcome! 👍
I'll set one up now through GitHub, and you can let me know what else needs to be changed.
Code:
Output:
Reproduction: https://github.com/sobolevn/django_stubs_example
I guess that variance of the argument is incorrect.