最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Could not find a declaration file for module '@hookformresolverszod' - Stack Overflow

programmeradmin5浏览0评论

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

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.

Share Improve this question asked Jun 4, 2023 at 8:24 pradeep muruganpradeep murugan 6751 gold badge11 silver badges21 bronze badges 4
  • 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
Add a ment  | 

2 Answers 2

Reset to default 5

I 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.

发布评论

评论列表(0)

  1. 暂无评论