-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
[BUG] TypeError in useAction when using a yup schema #183
Comments
Cannot reproduce the issue: My guess is you just need to uninstall zod and @typeschema/zod, maybe delete node_modules and lockfile as well, then reinstall dependencies and reload the editor. TypeSchema works with dynamic imports and TypeScript magic, so it causes errors sometimes. If the issue persists I'll need a reproduction link to investigate this. |
I tested it inside a CodeSandbox and the errors are not present. Thank you for the quick response. I will try it out and come back if I have any issues. |
Any updates on this issue? |
After deleting package-lock and node_modules, now useAction types are working. |
Kinda weird, have you tried reloading the editor? |
Yes. Still there. |
Most certainly it's because I am in a monorepo. Unfortunately I can't pin where the actual problem is. |
Are you using the latest version of this library?
Is there an existing issue for this?
Describe the bug
I tryied a zod schema and works fine.
But with a yup schema:
Reproduction steps
Using "typescript": "^5.4.2", "@typeschema/yup": "^0.13.3", "next": "14.1.1", "react": "^18.2.0", "next-safe-action": "^7.1.0"
My client:
defineMetadataSchema throws:
Using useAction in the FE throws a TypeError:
const { execute, executeAsync, result, status, reset, isIdle, isExecuting, hasSucceeded, hasErrored } = useAction(actionOnboarding);
useAction expects Zod:
Expected behavior
useAction should expect the yup schema and not the zod one.
defineMetadataSchema should accept yup.
Minimal reproduction example
https://github.com
Operating System
macOS
Library version
7.1.0
Next.js version
14.1.1
Additional context
No response
The text was updated successfully, but these errors were encountered: