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
When a custom QuerySet subclass is defined without explicit type
parameters (e.g. `class MyQS(QuerySet): ...`), make it implicitly
generic by copying the parent QuerySet's type variables, analogous
to the existing `reparametrize_any_manager_hook` for Manager
subclasses.
This enables the annotate plugin hook to propagate annotation type
information through custom querysets via `copy_modified(args=...)`,
which requires the queryset class to have type variables.
Copy file name to clipboardExpand all lines: tests/typecheck/managers/querysets/test_union_type.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@
10
10
11
11
reveal_type(model_cls) # N: Revealed type is "type[myapp.models.Order] | type[myapp.models.User]"
12
12
reveal_type(model_cls.objects) # N: Revealed type is "myapp.models.ManagerFromMyQuerySet[myapp.models.Order] | myapp.models.ManagerFromMyQuerySet[myapp.models.User]"
13
-
reveal_type(model_cls.objects.my_method()) # N: Revealed type is "myapp.models.MyQuerySet"
13
+
reveal_type(model_cls.objects.my_method()) # N: Revealed type is "myapp.models.MyQuerySet[Any, Any]"
0 commit comments