@hookform/resolvers
Advanced tools
Comparing version 2.2.0 to 2.3.0
{ | ||
"name": "@hookform/resolvers", | ||
"amdName": "hookformResolvers", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator and etc.", | ||
@@ -54,2 +54,8 @@ "main": "dist/resolvers.js", | ||
}, | ||
"./io-ts": { | ||
"browser": "./io-ts/dist/io-ts.module.js", | ||
"umd": "./io-ts/dist/io-ts.umd.js", | ||
"import": "./io-ts/dist/io-ts.mjs", | ||
"require": "./io-ts/dist/io-ts.js" | ||
}, | ||
"./package.json": "./package.json", | ||
@@ -77,3 +83,6 @@ "./": "./" | ||
"class-validator/src", | ||
"class-validator/dist" | ||
"class-validator/dist", | ||
"io-ts/package.json", | ||
"io-ts/src", | ||
"io-ts/dist" | ||
], | ||
@@ -91,2 +100,3 @@ "publishConfig": { | ||
"build:superstruct": "microbundle --cwd superstruct --globals '@hookform/resolvers=hookformResolvers'", | ||
"build:io-ts": "microbundle --cwd io-ts --globals '@hookform/resolvers=hookformResolvers'", | ||
"build:vest": "microbundle --cwd vest --globals '@hookform/resolvers=hookformResolvers'", | ||
@@ -113,3 +123,4 @@ "build:class-validator": "microbundle --cwd class-validator --globals '@hookform/resolvers=hookformResolvers'", | ||
"vest", | ||
"class-validator" | ||
"class-validator", | ||
"io-ts" | ||
], | ||
@@ -140,3 +151,6 @@ "repository": { | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"fp-ts": "^2.7.0", | ||
"husky": "^4.3.8", | ||
"io-ts": "^2.0.0", | ||
"io-ts-types": "^0.5.16", | ||
"jest": "^26.6.3", | ||
@@ -146,2 +160,4 @@ "joi": "^17.3.0", | ||
"microbundle": "^0.13.0", | ||
"monocle-ts": "^2.3.9", | ||
"newtype-ts": "^0.3.4", | ||
"npm-run-all": "^4.1.5", | ||
@@ -148,0 +164,0 @@ "prettier": "^2.2.1", |
<div align="center"> | ||
<p align="center"> | ||
<a href="https://react-hook-form.com" title="React Hook Form - Simple React forms validation"> | ||
<img src="https://raw.githubusercontent.com/bluebill1049/react-hook-form/master/docs/logo.png" alt="React Hook Form Logo - React hook custom hook for form validation" width="300px" /> | ||
<img src="https://raw.githubusercontent.com/bluebill1049/react-hook-form/master/docs/logo.png" alt="React Hook Form Logo - React hook custom hook for form validation" /> | ||
</a> | ||
@@ -19,6 +19,2 @@ </p> | ||
## Goal | ||
We are moving away from native support for Yup validation. We are now supporting other schema validation after React Hook Form v6. | ||
## Install | ||
@@ -252,3 +248,2 @@ | ||
```tsx | ||
import 'reflect-metadata'; | ||
import React from 'react'; | ||
@@ -298,2 +293,38 @@ import { useForm } from 'react-hook-form'; | ||
### [io-ts](https://github.com/gcanti/io-ts) | ||
Validate your data with powerful decoders. | ||
[![npm](https://img.shields.io/bundlephobia/minzip/io-ts?style=for-the-badge)](https://bundlephobia.com/result?p=io-ts) | ||
```typescript jsx | ||
import React from 'react'; | ||
import { useForm } from 'react-hook-form'; | ||
import { ioTsResolver } from '@hookform/resolvers/io-ts'; | ||
import t from 'io-ts'; | ||
// you don't have to use io-ts-types but it's very useful | ||
import tt from 'io-ts-types'; | ||
const schema = t.type({ | ||
username: t.string, | ||
age: tt.NumberFromString, | ||
}); | ||
const App = () => { | ||
const { register, handleSubmit } = useForm({ | ||
resolver: ioTsResolver(schema), | ||
}); | ||
return ( | ||
<form onSubmit={handleSubmit((d) => console.log(d))}> | ||
<input name="username" ref={register} /> | ||
<input name="age" type="number" ref={register} /> | ||
<input type="submit" /> | ||
</form> | ||
); | ||
}; | ||
export default App; | ||
``` | ||
## Backers | ||
@@ -300,0 +331,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
241856
153
1927
350
35
14