Replies: 1 comment 1 reply
-
Pyright is working as intended here, so this isn't a bug. The If you want your code to work with static analysis, you'll need to avoid this pattern. Here's one way that you could change your code to eliminate type errors: @property
def media_type(self) -> str | None:
# Check self.content directly rather than calling a method to check it
return self.content.media_type if self.content else None |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi folks!
Don't know if it's a bug or not. Here is the code example:
pyright complains
But if I inline condition from
has_content
property then it stops complainingIs it a bug? WDYT?
Beta Was this translation helpful? Give feedback.
All reactions