Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form is not correctly typed #1

Open
AFusco opened this issue Aug 20, 2024 · 3 comments
Open

form is not correctly typed #1

AFusco opened this issue Aug 20, 2024 · 3 comments

Comments

@AFusco
Copy link

AFusco commented Aug 20, 2024

It appears that useHookFormAction returns form as UseFormReturn<any, any> when ideally it should return UseFormReturn<z.infer<typeof mySchema>, any>

@TheEdoRan
Copy link
Contributor

It's working fine on my end 🤔

image

Have you tried to reload the editor window? Maybe it's just a caching issue.

@AFusco
Copy link
Author

AFusco commented Aug 23, 2024

I tried reloading and it doesn't work. Can you show the code behind your screenshot? I was simply colling useHookFormAction() Do I have to call useHookFormAction?

@TheEdoRan
Copy link
Contributor

I've used the login form of this repo's example app:

const { form, action, handleSubmitWithAction, resetFormAndAction } =
useHookFormAction(loginAction, zodResolver(loginSchema), {
formProps: {
mode: "onChange",
},
actionProps: {
onSuccess: () => {
window.alert("Logged in successfully!");
resetFormAndAction();
},
},
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants