Im trying to use zod with react-hook-form but the import hook form resolver gives the error below
Could not find a declaration file for module '@hookform/resolvers/zod'. '/pradeep/projects/react/safe-zone/node_modules/@hookform/resolvers/zod/dist/zod.mjs' implicitly has an 'any' type.
Im trying to use zod with react-hook-form but the import hook form resolver gives the error below
Share Improve this question asked Jun 4, 2023 at 8:24 pradeep muruganpradeep murugan 6751 gold badge11 silver badges21 bronze badges 4Could not find a declaration file for module '@hookform/resolvers/zod'. '/pradeep/projects/react/safe-zone/node_modules/@hookform/resolvers/zod/dist/zod.mjs' implicitly has an 'any' type.
- arunmichaeldsouza./blog/aliasing-module-paths-in-node-js – ullas kunder Commented Jun 4, 2023 at 9:44
- you can try adding a paths configuration in your package.json file to create an alias for the module import. – ullas kunder Commented Jun 4, 2023 at 9:45
- 1 "pilerOptions": { "baseUrl": ".", "paths": { "@hookform/resolvers/zod": ["./node_modules/@hookform/resolvers/zod/dist/zod.mjs"] } } – ullas kunder Commented Jun 4, 2023 at 9:45
- I tried this but no luck. – pradeep murugan Commented Jun 5, 2023 at 2:37
2 Answers
Reset to default 5I got this resolved by running the below cmd
npm i -save-dev @hookform/resolvers
Check the version of @hookform/resolvers
being installed.
for me it was installing version 2.*.*
instead of the latest version ^3.9.0
.
I updated the @hookform/resolvers
version manually in the package.json. Then run yarn install
.