SetupBindings in vue.d.ts should be optional

This issue has been created since 2022-07-29.

Version

2.7.8

Reproduction link

stackblitz.com

Steps to reproduce

run npx tsc in terminal.

You will get following error message:

comp-26/dist/message.d.ts:2:32 - error TS2314: Generic type 'ExtendedVue' requires 6 type argument(s).

  2 export declare const vMessage: import('vue/types/vue').ExtendedVue<
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3   Vue,
    ~~~~~~
... 
  9   Record<never, any>
    ~~~~~~~~~~~~~~~~~~~~
 10 >;
    ~


Found 1 error in comp-26/dist/message.d.ts:2

What is expected?

Pass the type checking.

What is actually happening?

I use a Vue component library with Typescript in my project. The component from the library is built on Vue 2.6.

Vue 2.7 changed the vue.d.ts, the type definition generated by Vue 2.6 is not compatible with 2.7.

message.js

import Vue from 'vue';
export const vMessage = Vue.extend({
  data: {
    message: 'Hello Vue v2.6!',
  },
  template: '<div>{{ message }}</div>',
});

message.d.ts

import Vue from 'vue';
export declare const vMessage: import('vue/types/vue').ExtendedVue<
  Vue,
  {
    message: string;
  },
  unknown,
  unknown,
  Record<never, any>
>;

There are 6 type parameters in Vue 2.7.

vue/types/vue.d.ts

export type ExtendedVue<
  Instance extends Vue,
  Data,
  Methods,
  Computed,
  Props,
  SetupBindings
> = VueConstructor<
  CombinedVueInstance<Instance, Data, Methods, Computed, Props, SetupBindings> &
    Vue
>

SetupBindings in vue.d.ts should be optional.

wadizaatour wrote this answer on 2022-08-03

I would like to create a pull request for this issue! can someone help me ?

jf-paradis wrote this answer on 2022-08-05

The change also breaks @vue/test-utils 1.x as both ExtendedVue and CombinedVueInstance are failing.

node_modules/@vue/test-utils/types/index.d.ts:191:90 - error TS2314: Generic type 'ExtendedVue' requires 6 type argument(s).

191 export declare function mount<V extends Vue, Data, Methods, Computed, Props> (component: ExtendedVue<V, Data, Methods, Computed, Props>, options?: ThisTypedMountOptions<V>): Wrapper<CombinedVueInstance<V, Data, Methods, Computed, Props> & Vue>
                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@vue/test-utils/types/index.d.ts:191:183 - error TS2314: Generic type 'CombinedVueInstance' requires 6 type argument(s).

191 export declare function mount<V extends Vue, Data, Methods, Computed, Props> (component: ExtendedVue<V, Data, Methods, Computed, Props>, options?: ThisTypedMountOptions<V>): Wrapper<CombinedVueInstance<V, Data, Methods, Computed, Props> & Vue>
                                                                                                                                                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@vue/test-utils/types/index.d.ts:193:80 - error TS2314: Generic type 'ExtendedVue' requires 6 type argument(s).

193 export declare function mount<V extends Vue, Props = DefaultProps> (component: ExtendedVue<V, {}, {}, {}, Props>, options?: FunctionalComponentMountOptions<V>): Wrapper<CombinedVueInstance<V, {}, {}, {}, Props> & Vue>
                                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@vue/test-utils/types/index.d.ts:193:170 - error TS2314: Generic type 'CombinedVueInstance' requires 6 type argument(s).

193 export declare function mount<V extends Vue, Props = DefaultProps> (component: ExtendedVue<V, {}, {}, {}, Props>, options?: FunctionalComponentMountOptions<V>): Wrapper<CombinedVueInstance<V, {}, {}, {}, Props> & Vue>
                                                                                                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@vue/test-utils/types/index.d.ts:197:97 - error TS2314: Generic type 'ExtendedVue' requires 6 type argument(s).

197 export declare function shallowMount<V extends Vue, Data, Methods, Computed, Props> (component: ExtendedVue<V, Data, Methods, Computed, Props>, options?: ThisTypedShallowMountOptions<V>): Wrapper<CombinedVueInstance<V, Data, Methods, Computed, Props> & Vue>
                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@vue/test-utils/types/index.d.ts:197:197 - error TS2314: Generic type 'CombinedVueInstance' requires 6 type argument(s).

197 export declare function shallowMount<V extends Vue, Data, Methods, Computed, Props> (component: ExtendedVue<V, Data, Methods, Computed, Props>, options?: ThisTypedShallowMountOptions<V>): Wrapper<CombinedVueInstance<V, Data, Methods, Computed, Props> & Vue>
                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@vue/test-utils/types/index.d.ts:199:87 - error TS2314: Generic type 'ExtendedVue' requires 6 type argument(s).

199 export declare function shallowMount<V extends Vue, Props = DefaultProps> (component: ExtendedVue<V, {}, {}, {}, Props>, options?: FunctionalComponentShallowMountOptions<V>): Wrapper<CombinedVueInstance<V, {}, {}, {}, Props> & Vue>
                                                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@vue/test-utils/types/index.d.ts:199:184 - error TS2314: Generic type 'CombinedVueInstance' requires 6 type argument(s).

199 export declare function shallowMount<V extends Vue, Props = DefaultProps> (component: ExtendedVue<V, {}, {}, {}, Props>, options?: FunctionalComponentShallowMountOptions<V>): Wrapper<CombinedVueInstance<V, {}, {}, {}, Props> & Vue>
More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-09-27
Star Count 199644
Watcher Count 6098
Fork Count 32848
Issue Count 587

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Fixed light not getting added 2 2022-07-09 2022-09-15
panic with 'spec not supported' when specifying `--hardfork muir_glacier` 13 2022-07-11 2022-09-14
zarr list directory shows `.` and trailing `/` handling 0 2022-07-14 2022-09-17
[BUG] The method save_node() doesn't work with already saved nodes 0 2022-03-22 2022-08-29
Q: whether MACS2 could randomly select a certain number of cells in a sample to call peaks 2 2021-09-03 2022-07-26
Runtimerror launcing Cadence 2 2021-10-29 2022-09-17
Aggregate block information 0 2022-04-16 2022-07-06
Cropper doesn't take parent's height when parent is relative 8 2021-12-30 2022-07-11
Errors with Google conformance tests 5 2020-06-17 2022-08-03
How to make it work on Nuxt SSR 10 2021-06-29 2022-09-27
4.5.3 requires github access to install... 14 2021-05-02 2022-09-10
Exchange rate UI should display fees as well 0 2021-06-16 2022-09-09
dind pods are not getting created 1 2021-09-06 2022-09-10
Missing `Optional[]` in `arcade.Window.__init__()` 2 2022-08-01 2022-09-18
Text should not modify the view matrix 0 2022-08-01 2022-09-18
Tooltip doesn't use correct color palette 1 2022-08-13 2022-09-10
Remove notification that it is running in Chrome 3 2021-08-11 2022-09-14
Attending the `TODO`s 6 2022-01-22 2022-09-14
[BUG]Сигналер убил ноутбук 1 2021-10-21 2022-07-21
When dependencies of config file change, dev server doesn't restart as espect. 1 2021-11-21 2022-09-21
Android Sample project of RTM get error cannot resolve RtmFileMessage, RtmImageMessage and RtmMediaOperationProgress 3 2020-09-07 2022-08-19
Add examples 0 2021-02-08 2021-12-25
Implement secure ZooKeeper client 0 2021-02-08 2022-09-08
Extend unit testing coverage 0 2021-02-07 2022-09-08
"docker-credential-ecr-login can only be used with Amazon Elastic Container Registry." error message occur in kpack-controller pod after upgrading kpack version to 0.6.0 12 2022-06-21 2022-09-14
Console search bar overlaps modals 0 2022-09-18 2022-09-26
Contract Deployment Fails with: private transaction manager is not in use 4 2022-03-30 2022-09-16
lab 7: small typo and clarification needed 0 2021-05-05 2022-09-03
Plugin doesn't catch files with shebang on first run 5 2021-03-30 2022-09-13
Red line displayed when switching from single to multi hop 0 2022-02-10 2022-07-21
error on saving 1 2021-09-07 2021-12-28
`npm init video` throws an error 1 2022-06-30 2022-09-25
`builtins.getFlake` fails with "cannot write modified lock file" 2 2022-05-17 2022-08-26
Issues With Admin Font Installation 1 2021-12-24 2022-09-23
panic: runtime error: invalid memory address or nil pointer dereference - Reconciling Bastion 2 2022-05-05 2022-08-31
Close Photoswipe when focus leaves 1 2022-04-29 2022-09-12
Data validation failed in gemini-with-nemesis test 0 2022-04-07 2022-04-03
better error message for exit("hello") 11 2017-08-10 2022-08-26
Behavior of fail-fast flag on 4.1.23? 6 2021-12-13 2022-09-19
Message flow for mediated messages 3 2020-09-09 2022-09-19
Renaming default branch to main 0 2021-02-02 2022-09-19
Promoting LORAMAC_VERSION and LORAMAC_FALLBACK_VERSION to the header? 6 2022-03-15 2022-09-20
Add security policy 0 2021-01-25 2022-01-12
About this app dialog broken 1 2022-07-02 2022-09-26
Build problem 5 2021-01-29 2022-01-17
random module in python 2022 can't use random module 3 2022-07-20 2022-09-19
🐛 Bug Report: Can not use "Query" option at ListDocument to search database at Appwrite CLI 5 2022-03-02 2022-09-21
为什么vocab里必须既有[UNK]又有<unk>呢? 6 2021-07-03 2022-09-24
Shelly Plug S Tasmota schaltet sich ab 1 2022-09-10 2022-09-25
No way to select upgrade options when upgrading in cmd line 4 2021-12-23 2022-09-15