-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: handle change method #58
Conversation
- simplifu decoder return type - allow nulls in instanceOf decoder - expose constructor from isntanceOf decoder
return Number.isFinite(value) | ||
? { ok: true, value } | ||
: { ok: false, value }; | ||
return Number.isFinite(value) ? { ok: true, value } : { ok: false }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor, imho it's worth mentioning in docs, what values/types are accepted, as the area wider than finite numbers only
same for the rest of the decoders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each decoder has jsdoc attached to it, check them out :)
for number there is:
/**
* Define field of type `number | ""` (empty string is needed to represent state of empty number inputs)
* Does not accept infinite numbers: `Infinity`, `-Infinity`, `NaN`.
* Default initial value will be `""`.
*
* @example
* ```
* const Schema = createForm.schema(fields => ({
* x: fields.number() // x: number | ""
* }));
* ```
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsdoc improved
FieldHandle.handleChange
which attempts to extract value out of change events for convenience.instanceOf
decoder in favour ofdate
decodercloses #49