`safeValue` is like `$` of `FieldState` in formstate-x v2, while with some differences: 1. Naming as `safeValue` (or something else) instead of `$` 2. All states (including `FormState`, `ArrayFormState`, etc.) will provide `safeValue` 3. It should be type-safe (deciding by validators - they may narrow type of value)
Activity
nighca commentedon Nov 23, 2021
Related discussion: https://github.com/qbox/horn/pull/340#discussion_r699824181
nighca commentedon Nov 23, 2021
Some ideas:
1. Auto type inference by validators
It's hard, maybe impossible
2. Generic type passing with validator
3. Generic type passing with constructor
4. Type assertion while read
safeValueThis is not real "type-safe"..
mattleonowicz commentedon May 11, 2022
One thing to consider: should this value be defined and available even when validators return errors?
If not, then 2. makes sense.
But if this value is always defined, regardless of latest validation result, then I would suggest not linking the safeType with validators as in 2.
nighca commentedon May 12, 2022
Accessing safe-value will throw if currently validation not passed.