Releases: zackify/validify
Releases · zackify/validify
5.7.4
5.7.3
Switch rules back to partial, TS doesn't always check the full value unfortunately.
Ex:
rules={{email: []}}
will pass the type check even though it says the array must have a rule function in it. And it sometimes allows extra properties inside of the rules object, even though hovering over it confirms the type should only have the values inside of it.
5.7.2
5.7.1
5.7.0
-
Added ability to use the form without rules, if you just want it to manage state, the
rules
prop may now be omitted -
Added better TS support with generics:
type TestValues = {
email: string;
date1?: string;
name?: string;
};
export const TestForm = ({ onSubmit, noRules }: Props) => {
let [values, setValues] = useState<TestValues>({ email: 'test' });
return (
<Form
values={values}
onValues={setValues}
rules={{
email: [required, email],
date1: [greaterThanDate2],
name: [required],
}}
>
If you pass a rule that doesn't match a key from TestValues
TS will error as expected!
5.6.1
5.6.0
5.5.0-beta4
- TS types for root from / rules
- Automate build process with gh actions
- Write a test to confirm all is working
5.5.0-beta
-beta release, testing new ci automation + tests + typescript types
5.3.0-beta
- Add support for nested objects:
let [values, setValues] = useState({
address: { city: 'test city' }
email: '[email protected]'
})
return <Form
values={values}
onValues={setValues}
rules={{
'address.city': [(value: string) => (value.length < 3 ? 'Test' : 'Test 2')],
}}
>
<Input label="Email" name="email" />
<Input label="Street Address" name="address.street" />
</Form>