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
{{ message }}
Repository navigation
Django: annotate() attributes are typed Unknown instead of their expression type #5734
Since #4928, pyrefly knows the attributes that QuerySet.annotate() adds to model rows, so accessing them no longer reports missing-attribute. Their type is Unknown, though, so nothing about the value is checked: row.n_books + "x" passes.
The type is known from the expression: Count gives int, Exists gives bool, Sum over a DecimalField gives Decimal | None (None when there are no rows), and an explicit output_field decides the type when given.
Annotated attributes get the type of their expression, using output_field when it is given, and Unknown only where the expression type can't be worked out.
Activity