logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.74k stars 1.26k forks source link

[V3] Conflict of TypeScript definition with VueJS 2.7 #3865

Closed Vince-F closed 2 years ago

Vince-F commented 2 years ago

What happened?

Hello,

Following Vue 2.7 release, the typings of VueJS have been modified especially the types "ExtendedVue" and "CombinedVueInstance" to add the "SetupBindings" (for the composition API). It seems this update messes with the typings of veevalidate internally that depends on Vue types.

image

Reproduction steps

  1. use Vue 2.7 in your project
  2. use VeeValidate 3.X (3.4.14 for isntance)
  3. generate the declaration with TypeScript (tsc --emitDeclarationOnly)

Version

Vue.js 2.x and vee-validate 3.x

What browsers are you seeing the problem on?

Relevant log output

> tsc --emitDeclarationOnly

node_modules/vee-validate/dist/types/components/Observer.d.ts:19:42 - error TS2314: Generic type 'ExtendedVue' requires 6 type argument(s).

 19 export declare const ValidationObserver: import("vue/types/vue").ExtendedVue<Vue & {
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 20     $_veeObserver: VeeObserver;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
108     disabled: boolean;
    ~~~~~~~~~~~~~~~~~~~~~~
109 }>;
    ~~

node_modules/vee-validate/dist/types/components/Provider.d.ts:3:42 - error TS2314: Generic type 'ExtendedVue' requires 6 type argument(s).

  3 export declare const ValidationProvider: import("vue/types/vue").ExtendedVue<Vue & {
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4     $_veeObserver: VeeObserver;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
 60     detectInput: boolean;
    ~~~~~~~~~~~~~~~~~~~~~~~~~
 61 }>;
    ~~

node_modules/vee-validate/dist/types/localeChanged.d.ts:2:26 - error TS2314: Generic type 'CombinedVueInstance' requires 6 type argument(s).

2 declare const EVENT_BUS: import("vue/types/vue").CombinedVueInstance<Vue, object, object, object, Record<never, any>>;

Demo link

no link provided

Code of Conduct

logaretm commented 2 years ago

This seems to be fixed recently in https://github.com/vuejs/vue/commit/00458cd38d209410d3c675729230a42a0a34a4b9

Let me know if that's not the case once it is released.