Should ValueElement be Generic[V] ?
#2677
petergaultney
started this conversation in
Ideas / Feature Requests
Replies: 2 comments 2 replies
-
|
Hi @petergaultney, that's a great idea! It always feels a bit odd that the It's hard to foresee all consequences though. E.g. there's the Would you like to give it a go? 🙂 |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
Got it working in #5785 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
NiceGUI has the concept of a ValueElement, which contains a
valueattribute (Bindable Property) that can be set and retrieved.For the subset of these that I've taken a look at, they have a 'correct' type of the value. For instance,
Inputhasvalue: str, whereasnumberhasvalue: floatAt the moment, the code types these as
Anybecause the parent mixin (ValueElement) is not represented as Generic. But it seems like that would be possible, and not too hard to do? And then we could change toset_value(value: V)(instead ofAny), and more NiceGUI-using code could take advantage of types.Beta Was this translation helpful? Give feedback.
All reactions