Cannot find module 'yup' or its corresponding type declarations

See original GitHub issue

Versions

  • vee-validate": "^4.4.0-alpha.2 and 4.3.6
  • vue: 3.0.5

Describe the bug

I’m using vite/vue 3 and when I’m building my project, I got this error:

node_modules/vee-validate/dist/vee-validate.d.ts:3:66 - error TS2307: Cannot find module 'yup' or its corresponding type declarations.

3 import { SchemaOf, AnySchema, AnyObjectSchema, BaseSchema } from 'yup';

I think that yup should be added as peerDependencies in node_modules/vee-validate/package.json just like vue package In order to fix my issue I installed it as dev dependencies in my package.

Notice: I’m not using yup at all in my validatation form process.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
yassineelhoubicommented, Feb 27, 2022

You need to add yup types yarn add @types/yup

1reaction
logaretmcommented, Jan 19, 2022

@aussieboi I would need to drop using yup types completely and use ‘any’ instead.

This would be a shame since that means form schema object won’t be typed anymore. On the other hand you are right about it shouldn’t error out while it is optional.

I will try to resolve this in v4.6 as I’m unsure about how to proceed at the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Yup - npm
Start using yup in your project by running `npm i yup`. ... TypeScript icon, indicating that this package has built-in type declarations.
Read more >
cannot find module 'yup' or its corresponding type declarations
I think that yup should be added as peerDependencies in node_modules/vee-validate/package.json just like vue package In order to fix my issue I installed...
Read more >
Cannot find module 'X' Error in TypeScript | bobbyhadz
The "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project....
Read more >
How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
TIL: TypeScript | Fix "TS2307: Cannot find module 'src' or its ...
... node_modules/@vue/test-utils/dist/domWrapper.d.ts:5:28 - error TS2307: Cannot find module 'src' or its corresponding type declarations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found