You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want the typings of use_state to match the behaviour of React.useState.
In particular, if you want to define an optional number value, you should be able to define it simply as:
x, set_x = use_state[int]()
# x should be type `int | None`
We want the typings of
use_state
to match the behaviour ofReact.useState
.In particular, if you want to define an optional number value, you should be able to define it simply as:
This will require python 3.12, for the type parameter syntax: https://docs.python.org/3/reference/compound_stmts.html#type-params
Also see discussion about applying default values with overloads: python/mypy#3737 (comment)
The text was updated successfully, but these errors were encountered: