typeddjango / djangorestframework-stubs

PEP-484 stubs for django-rest-framework
MIT License
453 stars 117 forks source link

GenericAPIView serializer_class type should use _MT_co #673

Closed jheld closed 1 month ago

jheld commented 1 month ago

Bug report

What's wrong

The typing is a little incorrect as the truthy type does not match what the get_serializer_class returns.

How is that should be

serializer_class probably should be: type[BaseSerializer[_MT_co]] | None so that the truthy object type matches what get_serializer_class returns.

System information