Skip to content

Commit d5d88ba

Browse files
chore(deps): update zod to latest version
1 parent 0ea15dc commit d5d88ba

10 files changed

Lines changed: 124 additions & 35 deletions

File tree

apps/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"react-redux": "8.1.3",
3535
"react-router-dom": "6.30.4",
3636
"react-toastify": "11.1.0",
37-
"zod": "3.25.76"
37+
"zod": "4.4.3"
3838
},
3939
"devDependencies": {
4040
"@babel/core": "7.29.7",

apps/demo/src/Views/Form/components/FormInput/FormInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const FormInputDemo = () => {
3232
name: zod.string().min(1, t("formInput.message.required")),
3333
number: zod
3434
.number({
35-
required_error: t("formInput.message.required"),
35+
error: t("formInput.message.required"),
3636
})
3737
.nullable()
3838
.refine((data) => data !== null, {

packages/form/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
},
3535
"dependencies": {
3636
"@hookform/error-message": "2.0.1",
37-
"@hookform/resolvers": "3.10.0",
37+
"@hookform/resolvers": "5.5.7",
3838
"react-debounce-input": "3.3.0",
3939
"react-dropzone": "14.4.1",
4040
"react-hook-form": "7.82.0",
4141
"validator": "13.15.35",
42-
"zod": "3.25.76"
42+
"zod": "4.4.3"
4343
},
4444
"devDependencies": {
4545
"@prefabs.tech/eslint-config": "0.8.7",

packages/form/src/components/Form.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import type { ZodType } from "zod";
2+
13
import { zodResolver } from "@hookform/resolvers/zod";
24
import React, { Children, createElement } from "react";
35
import { useForm, UseFormProps } from "react-hook-form";
4-
import { ZodEffects, ZodObject } from "zod";
56

67
interface IForm extends UseFormProps {
78
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -10,8 +11,9 @@ interface IForm extends UseFormProps {
1011
html5Validation?: boolean;
1112
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1213
onSubmit: (data: any) => void;
14+
1315
// eslint-disable-next-line @typescript-eslint/no-explicit-any
14-
validationSchema?: ZodEffects<any> | ZodObject<any>;
16+
validationSchema?: ZodType<any, any, any>;
1517
}
1618

1719
export const Form: React.FC<IForm> = ({

packages/form/src/components/FormProvider.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import type { ZodType } from "zod";
2+
13
import { zodResolver } from "@hookform/resolvers/zod";
24
import React, { useEffect } from "react";
35
import { FormProvider, useForm, UseFormProps } from "react-hook-form";
4-
import { ZodEffects, ZodObject } from "zod";
56

67
import { FormSubmitOptions } from "..";
78

@@ -11,8 +12,9 @@ interface IForm extends UseFormProps {
1112
html5Validation?: boolean;
1213
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1314
onSubmit: (data: any, options?: FormSubmitOptions) => any;
15+
1416
// eslint-disable-next-line @typescript-eslint/no-explicit-any
15-
validationSchema?: ZodEffects<any> | ZodObject<any>;
17+
validationSchema?: ZodType<any, any, any>;
1618
validationTriggerKey?: string;
1719
}
1820

packages/form/src/types/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ZodObject } from "zod";
2+
13
import {
24
FieldValues,
35
UseFormClearErrors,
@@ -8,13 +10,12 @@ import {
810
UseFormResetField,
911
UseFormSetError,
1012
} from "react-hook-form";
11-
import { ZodObject } from "zod";
1213

1314
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1415
export type AdditionalDefaultValues = Record<string, any>;
1516

1617
// eslint-disable-next-line @typescript-eslint/no-explicit-any
17-
export type AdditionalFormSchema = ZodObject<any>;
18+
export type AdditionalFormSchema = ZodObject<any, any>;
1819

1920
export type FormSubmitOptions<TFieldValues extends FieldValues = FieldValues> =
2021
{

packages/user/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"dependencies": {
3636
"supertokens-web-js": "0.6.0",
37-
"zod": "3.25.76"
37+
"zod": "4.4.3"
3838
},
3939
"devDependencies": {
4040
"@prefabs.tech/eslint-config": "0.8.7",

packages/user/src/components/Invitation/InvitationForm.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export const InvitationForm = ({
192192

193193
if (apps?.length || roles?.length) {
194194
const RoleFormSchema = zod.object({
195-
role: zod.string({ required_error: t("validation.messages.role") }),
195+
role: zod.string({ error: t("validation.messages.role") }),
196196
});
197197

198198
InvitationFormSchema = InvitationFormSchema.merge(RoleFormSchema);
@@ -201,7 +201,7 @@ export const InvitationForm = ({
201201
if (apps?.length) {
202202
const AppIdFormSchema = zod.object({
203203
app: zod.number({
204-
required_error: t("validation.messages.app"),
204+
error: t("validation.messages.app"),
205205
}),
206206
});
207207

@@ -211,7 +211,7 @@ export const InvitationForm = ({
211211
if (expiryDateField?.display) {
212212
const ExpiresAtFormSchema = zod.object({
213213
expiresAt: zod.date({
214-
required_error: t("validation.messages.expiresAt"),
214+
error: t("validation.messages.expiresAt"),
215215
}),
216216
});
217217

packages/user/src/components/Profile/ProfileForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export const ProfileForm = ({
2626
const config = useConfig();
2727
const [submitting, setSubmitting] = useState(false);
2828

29-
let profileValidationSchema: z.AnyZodObject = z.object({
29+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
30+
let profileValidationSchema: z.ZodObject<any, any> = z.object({
3031
givenName: z
3132
.string()
3233
.min(1, t("profile.form.validations.firstName.required")),

pnpm-lock.yaml

Lines changed: 103 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)