Vee-validate: Could not find a declaration file for module 'vee-validate/dist/locale/en'.

Created on 13 Jul 2018  路  4Comments  路  Source: logaretm/vee-validate

Versions

And I get a TS warning

[ts] Could not find a declaration file for module 'vee-validate/dist/locale/en'. '/Users/.../node_modules/vee-validate/dist/locale/en.js' implicitly has an 'any' type. Trynpm install @types/vee-validateif it exists or add a new declaration (.d.ts) file containingdeclare module 'vee-validate'; module "/Users/.../node_modules/vee-validate/dist/locale/en"

Expected behavior
I should not get a warning using ES6 ... why there is no @types/vee-validate` file available to be installed via npm ?

Desktop (please complete the following information):

  • OS: OSX
  • Browser Chrome
馃檹 help wanted

Most helpful comment

// vee-validate.d.ts

declare module 'vee-validate*';
or

declare module 'vee-validate'
declare module 'vee-validate/*';

or

declare module 'vee-validate'
declare module 'vee-validate/dist/locale/tr';
declare module 'vee-validate/dist/locale/en';
.
.
.

or

declare module 'vee-validate'
declare module 'vee-validate/dist/locale/*';

fixed my problem.

All 4 comments

Personally I don't use TypeScript so I'm unfamiliar with the issues that may arise from using it.

TypeScript definitions is maintained by the community of contributors, If you believe that there are issues with the typings then you can go ahead and PR the fix.

This file may need to be updated: https://github.com/baianat/vee-validate/blob/master/types/index.d.ts

found a solution 馃憤

  If you're importing a third-party module 'foo' that doesn't provide any typings, either in the library itself, or in the @types/foo package (generated from the DefinitelyTyped repository), then you can make this error go away by declaring the module in a .d.ts file:

  // vee-validate.d.ts
  declare module 'vee-validate'

// vee-validate.d.ts

declare module 'vee-validate*';
or

declare module 'vee-validate'
declare module 'vee-validate/*';

or

declare module 'vee-validate'
declare module 'vee-validate/dist/locale/tr';
declare module 'vee-validate/dist/locale/en';
.
.
.

or

declare module 'vee-validate'
declare module 'vee-validate/dist/locale/*';

fixed my problem.

Hello guys!!!
I create a file called vee-validate.d.t:
declare module 'vee-validate';
declare module 'vee-validate/dist/locale/es';

and then i have other file in the same directory called Login.ts:
import Vue from 'vue';

import VeeValidate, { Validator } from 'vee-validate';

import es from 'vee-validate/dist/locale/es';

Validator.localize('es', es);

No errors found but translate still not work!

Help please!

Was this page helpful?
0 / 5 - 0 ratings