-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyright confused with property setter typing #2424
Comments
The purpose of the |
Yeah okay, on reflection I think that's a reasonable lint and that transforming assignment should be in a separate method. I think it's a bit surprising to have this type of warning from a type checker, but I don't know what other kind of linter could throw the error so it's probably fine. Sorry for the noise! |
@erictraut I think maybe the error message could be reworded a bit? It read to me more like it's a runtime assignment mismatch and not a style complaint which caused my initial confusion. I don't think the existing wording is wrong per se, but maybe it could be signposted better that it's a style error (maybe verbs like "should" in combination with some sort of label indicating a style complaint?) Thanks for all your work and prompt responses always |
I've been working on this one a lot the last two days, and I wanted to collect the information here for posterity and to maybe see if you had any thoughts on the interaction with descriptors.
I thought the interaction with descriptors was interesting even if you don't want to change anything, cheers. |
|
Thanks for your thoughts as always. |
Hi, another report based on going through the rich codebase. I'm not convinced by pyright's warning here.
https://github.com/willmcgugan/rich/blob/256697915d9676b7d5cb6abd5559132ff5f92fdf/rich/table.py#L325
I'm not sure what's going on here; the typing all seems correct. Does pyright assume the error based on the type of the argument alone? Is this intended?
Someone seems to have run into a more self contained example online: https://stackoverflow.com/questions/69111948/property-setter-value-type-is-not-assignable-to-the-getter-return-type-str-is
I'm headed out but I'll try to make a minimal example when I get back (but at first glance the stackoverflow example seems ok)
The text was updated successfully, but these errors were encountered: