Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions src/hooks/useI18nForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { useEffect, useMemo } from 'react';
import { useForm, type FieldValues, type UseFormProps, type UseFormReturn } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import type { ZodType, ZodTypeDef } from 'zod';

type SchemaBuilder<TFormInput, TFormOutput> = (t: NotifycalTFunction) => ZodType<TFormOutput, ZodTypeDef, TFormInput>;
// Workaround while we update to Zod 4
interface Zod3Type<O = unknown, I = unknown> {
_output: O;
_input: I;
_def: {
typeName: string;
};
}

type SchemaBuilder<TFormInput, TFormOutput> = (t: NotifycalTFunction) => Zod3Type<TFormOutput, TFormInput>;
Copy link
Copy Markdown
Member

@sergiojoker11 sergiojoker11 Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens is zod ZopType isn't compatible with the first parameter of function zodResolver from @hookform/resolvers/zod - which is supposed to be equivalent. Sadly, that Zod3Type isn't exported. I tried the Parameter[0] trick but it ends up ugly as fuck.

They fucked up while adding support for zod 4


// Replicating react-hook-form useForm signature generics (including order)
export function useI18nForm<
Expand Down