Versions
vue: 2.5.1
Describe the bug
as stated in https://baianat.github.io/vee-validate/guide/localization.html#localized-files, I used
import English from 'vee-validate/dist/locale/en'
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):
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!
Most helpful comment
// vee-validate.d.ts
declare module 'vee-validate*';or
or
or
fixed my problem.