formik-validator-zod 2.2.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -7
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.d.ts +4 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ import { z } from 'zod'
|
|
|
25
25
|
import { withZodSchema } from 'formik-validator-zod'
|
|
26
26
|
|
|
27
27
|
const mySchema = z.object({
|
|
28
|
-
email: z.
|
|
28
|
+
email: z.email(),
|
|
29
29
|
name: z.string(),
|
|
30
30
|
age: z.number(),
|
|
31
31
|
})
|
|
@@ -39,11 +39,17 @@ const MyForm = () => {
|
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## Zod version support
|
|
43
|
+
|
|
44
|
+
| formik-validator-zod | Zod |
|
|
45
|
+
| -------------------- | --------- |
|
|
46
|
+
| `3.x` | `^4.0.0` |
|
|
47
|
+
| `2.x` | `^3.19.1` |
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
Version 3 of this library targets Zod 4. If you are still on Zod 3, stay on
|
|
50
|
+
`formik-validator-zod@2`.
|
|
51
|
+
|
|
52
|
+
## Is this library still maintained?
|
|
46
53
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
abandoned.
|
|
54
|
+
Yes. The library is small and stable, and it is kept up to date with new Zod
|
|
55
|
+
releases. Issues and pull requests are welcome.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ZodType } from 'zod';
|
|
2
|
+
type ParseParams = Parameters<ZodType['safeParse']>[1];
|
|
2
3
|
/**
|
|
3
4
|
* Allows you to easily use Zod schemas with the <Formik /> component `validate`
|
|
4
5
|
* prop.
|
|
@@ -7,4 +8,5 @@ import type { ZodSchema, ParseParams } from 'zod';
|
|
|
7
8
|
* <Formik {...} validate={withZodSchema(yourSchema)}>
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
|
-
export declare const withZodSchema: <T>(schema:
|
|
11
|
+
export declare const withZodSchema: <T>(schema: ZodType<T>, params?: ParseParams) => (values: T) => Partial<T>;
|
|
12
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formik-validator-zod",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Helper to simplify validating Formik values with Zod",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"prepare": "husky install",
|
|
13
13
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
14
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
14
|
+
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
15
15
|
"build": "npm-run-all -p build:esm build:cjs",
|
|
16
16
|
"test": "vitest"
|
|
17
17
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"author": "Luke Glazebrook <Glazy@users.noreply.github.com>",
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "git+https://github.com/Glazy/formik-validator-zod.git"
|
|
29
29
|
},
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"devDependencies": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"husky": "^8.0.0",
|
|
34
34
|
"npm-run-all": "^4.1.5",
|
|
35
35
|
"pretty-quick": "^3.1.3",
|
|
36
|
-
"typescript": "^
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
37
|
"vitest": "^0.24.3",
|
|
38
|
-
"zod": "^
|
|
38
|
+
"zod": "^4.0.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"formik": "^2.2.9",
|
|
42
|
-
"zod": "^
|
|
42
|
+
"zod": "^4.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"deepmerge": "^4.3.1"
|