strawberry
strawberry copied to clipboard
Generic parameter in the `strawberry.field` method is over-constrained
Describe the Bug
The strawberry.field
method conveniently has a generic overload such that the return type of the field
method is the return type of the passed function.
However, that overload types the passed function as Callable[[], T]
, meaning that (in pyright at least) the overload will only take effect when used with a 0-argument thunk causing the return type to be StrawberryField
. Instead, if Callable[..., T]
were used, then the overload would take effect for any function, properly typing the result.
System Information
- Strawberry version: 0.114.0
- Pyright version: 1.1.252
Additional Information
I'm happy to submit a PR for this (especially given the limited change required)
+1 for visibility
Hi @zwade! thanks for the issue report, a PR would be amazing to have!
This should have been fixed in #2172
@zwade let me know if that's not the case 😊
Thanks!