Skip to content

Commit

Permalink
Fix BaseSerializer and ListSerializer to_representation() retur…
Browse files Browse the repository at this point in the history
…n type
  • Loading branch information
intgr committed Nov 15, 2023
1 parent a46556c commit 1820385
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rest_framework-stubs/serializers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class BaseSerializer(Generic[_IN], Field[Any, Any, Any, _IN]):
def update(self, instance: _IN, validated_data: Any) -> _IN: ...
def create(self, validated_data: Any) -> _IN: ...
def save(self, **kwargs: Any) -> _IN: ...
def to_representation(self, instance: _IN) -> dict[str, Any]: ...
def to_representation(self, instance: _IN) -> Any: ...

class SerializerMetaclass(type):
def __new__(cls, name: Any, bases: Any, attrs: Any) -> Incomplete: ...
Expand All @@ -132,6 +132,7 @@ class Serializer(
@cached_property
def fields(self) -> BindingDict: ...
def get_fields(self) -> dict[str, Field]: ...
def to_representation(self, instance: _IN) -> dict[str, Any]: ...
def validate(self, attrs: Any) -> Any: ...
def __iter__(self) -> Iterator[BoundField]: ...
def __getitem__(self, key: str) -> BoundField: ...
Expand Down Expand Up @@ -175,6 +176,7 @@ class ListSerializer(
min_length: int | None = ...,
max_length: int | None = ...,
) -> None: ...
def to_representation(self, data) -> list[Any]: ...
def get_initial(self) -> list[Mapping[Any, Any]]: ...
def validate(self, attrs: Any) -> Any: ...
@property
Expand Down

0 comments on commit 1820385

Please sign in to comment.