Improve typing of handlers #3797
Closed
marcuslimdw
started this conversation in
Ideas / Feature Requests
Replies: 1 comment 1 reply
-
Thank for bringing this up, @marcuslimdw! The only downside I see in using type aliases might be that they "hide" the type behind the alias "Handler[ClickEventArguments]": ![]() But I guess this is better than "Callable[..., Any]". And it is widely known that a "handler" is a kind of callable. Would you like to create a pull request? 🙂 |
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
-
Currently, handlers are typed permissively e.g.
on_change
is typedOptional[Callable[..., Any]]
. This provides a poor DX because autocomplete and type checking don't work as well.I propose the following:
Handler
(see below).on_change
would now be annotatedHandler[ValueChangeEventArguments]
Beta Was this translation helpful? Give feedback.
All reactions