You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from django.db import models
from typing_extensions import Self
class MyQuerySet(BaseQuerySet):
def example_simple(self) -> Self: ...
class MyModel(models.Model):
objects = MyQuerySet.as_manager()
reveal_type(MyModel.objects.example_simple()) # -> Revealed type is "<nothing>"
What's wrong
The issue lies in the type revelation within the custom QuerySet method that is supposed to return Self. Currently, it reveals the type as <nothing>, which indicates that the Self type isn't properly recognized or handled.
How is that should be
The correct and expected behavior should reveal the type accurately, as per the following expectation:
reveal_type(MyModel.objects.example_simple()) # -> Revealed type is "myapp.models.ManagerFromMyQuerySet[myapp.models.MyModel]"
System information
OS:
python 3.12
django 3.2.12
mypy 1.6.1
django-stubs 4.2.5
django-stubs-ext 4.2.5
The text was updated successfully, but these errors were encountered:
Bug report
What's wrong
The issue lies in the type revelation within the custom QuerySet method that is supposed to return Self. Currently, it reveals the type as
<nothing>
, which indicates that the Self type isn't properly recognized or handled.How is that should be
The correct and expected behavior should reveal the type accurately, as per the following expectation:
System information
python
3.12django
3.2.12mypy
1.6.1django-stubs
4.2.5django-stubs-ext
4.2.5The text was updated successfully, but these errors were encountered: