Skip to content

SetupBindings in vue.d.ts should be optional #12717

Closed
@mingc00

Description

@mingc00

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions