-
Notifications
You must be signed in to change notification settings - Fork 828
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
Wrong type hint of DOMNode.watch method #1805
Comments
Merged
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
@willmcgugan This one is not fixed in 0.13.0 so shouldn't be closed. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
@willmcgugan error: Argument "callback" to "watch" of "DOMNode" has incompatible type "Callable[[], None]"; expected "Union[Callable[[Any], Awaitable[None]], Callable[[Any], None]]" [arg-type] It shows up when I attach callback method without any params: self.watch(self.app, "something", callback=self.__sync_cart_items)
def __sync_cart_items(self) -> None:
pass I have to apply workaround such as: self.watch(self.app, "something", callback=self.__sync_cart_items)
def __sync_cart_items(self, _: Something) -> None:
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like after the latest changes
0.11.0
(because in 0.10.1 there was no issue), the wrong type hint was used for DOMNode.watch method.After upgrading textual in my project I see mypy errorrs like below:
After some investigation, argument no.3 in the
0.11.0
is:which is:
This is not true because Callabe can take additional arguments - current_value and previous_value (both of the Any type).
Previously, in the
reactive.watch
method, it was:The text was updated successfully, but these errors were encountered: