Open anentropic opened 9 months ago
Correct. It looks like the annotation should probably be just Any
, as per the superclass: https://github.com/typeddjango/django-stubs/blob/2cb9c832e97ea5a73d11596696effaab065dff94/django-stubs/db/models/aggregates.pyi#L11 . Do you agree? If so, could you open a PR?
Python Version
3.11
Django Version
4.2
MariaDB/MySQL Version
MySQL 8.0
Package Version
latest
Description
First arg to constructor is currently annotated as
expression: Expression
:https://github.com/adamchainz/django-mysql/blob/main/src/django_mysql/models/aggregates.py#L27-L37
Example usage code in docs is:
"books__id"
is astr
and not anExpression
, giving type errors when using as intendedalso
F("books_id")
would not pass either, asF
does not inherit fromExpression
(they are both instances ofCombinable
)https://github.com/django/django/blob/4.2/django/db/models/expressions.py#L474