typeddjango / djangorestframework-stubs

PEP-484 stubs for django-rest-framework
MIT License
439 stars 115 forks source link

Improve `Serializer.to_representation()` return type #504

Closed 4c0n closed 10 months ago

4c0n commented 11 months ago

This PR adds a more specific return type to to_representation() . We can make up from the documentation and the implementation of Serializer that a dictionary is to be returned.

Please see: https://www.django-rest-framework.org/api-guide/serializers/#baseserializer https://github.com/encode/django-rest-framework/blob/master/rest_framework/serializers.py#L522

Thanks for your time and consideration!