Replies: 1 comment 2 replies
-
Those are good points. In an ideal world we'd have a way to access the converted values with full type safety, but we might have to settle for If it could be done via the existing The most important feature for my use case (and I suspect others) would be the ability to get an object containing all the type converted key/value pairs so we can throw them at a backend API easily. Again though, I'd be quite happy for that to be a Another requirement that may be less common is that fields would be able to set their converter/define what converter to use themselves. This would mean I could dynamically construct forms without duplicating per-field info at the top level and in the markup. The hacky version I've bashed out for now just passes a writable store to each field component, which then binds the field value and runs a function that casts the type. It works just fine, but it's a lot of boilerplate (when compared to how lovely and compact this lib is for handling the rest) and nowhere near as slick as what I think could be created as part of this package. I need to have a think about different approaches and maybe try to spike a couple. In the meantime very happy to hear anyone's thoughts, or what you would and wouldn't be happy to w/regards to the API exposed to users. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This discussion is based on the following comment by @manterfield
I believe that adding a new action as proposed is a good idea. However, I'm unsure on how we would go about adding typings. e.g. if one would coerce to a date, they would most likely expect that
$form.someControl.value
would also be of the same type. Furthermore since actions are only evaluated at runtime we couldn't really work with type inference here. As a consequence it would need to be defined inside the params of the useForm call. This would then again have the side effect that the default type forvalue
would need to beany
which would conflict with PR #63 by @Marnes.What are your thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions