nighca / movue

MobX integration for Vue.js.
Apache License 2.0
59 stars 13 forks source link

Vue.use TS error No overload matches this call #32

Open fairking opened 4 years ago

fairking commented 4 years ago

I cannot setup the movue package. Bellow is my code: package.json:

"movue": "0.3.2",
"mobx": "5.15.4"

tsconfig.json:

{
    "compileOnSave": false,
    "compilerOptions": {
        "target": "es5",
        "module": "esnext",
        "strict": true,
        "strictNullChecks": false,
        "noImplicitAny": false,
        "noImplicitThis": false,
        "removeComments": false,
        "allowUnreachableCode": false,
        "allowUnusedLabels": false,
        "importHelpers": true,
        "moduleResolution": "node",
        "experimentalDecorators": false,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "sourceMap": false,
        "allowJs": false,
        "baseUrl": ".",
        "types": [ "webpack-env", "jest" ],
        "paths": {
            "@/*": [ "src/*" ]
        },
        "lib": [ "es5", "esnext", "dom", "dom.iterable", "scripthost" ],
        "outDir": "dist"
    },
    "include": [ "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx" ],
    "files": [ "src/shims-vue.d.ts" ],
    "exclude": [ "node_modules" ]
}

main.ts:

import Vue from "vue";

import Movue from 'movue';
import { reaction } from 'mobx';

Vue.use(Movue, { reaction });

Screenshot: image

Error:

192:9 No overload matches this call.
  Overload 1 of 2, '(plugin: PluginObject<IMobxMethods> | PluginFunction<IMobxMethods>, options?: IMobxMethods): VueConstructor<...>', gave the following error.
    Argument of type '{ install: (Vue: typeof Vue, mobxMethods: IMobxMethods) => void; }' is not assignable to parameter of type 'PluginObject<IMobxMethods> | PluginFunction<IMobxMethods>'.
      Type '{ install: (Vue: typeof Vue, mobxMethods: IMobxMethods) => void; }' is not assignable to type 'PluginObject<IMobxMethods>'.
        Types of property 'install' are incompatible.
          Type '(Vue: typeof Vue, mobxMethods: IMobxMethods) => void' is not assignable to type 'PluginFunction<IMobxMethods>'.
            Types of parameters 'Vue' and 'Vue' are incompatible.
              Type 'VueConstructor<Vue>' is not assignable to type 'typeof Vue'.
                The types of 'config.errorHandler' are incompatible between these types.
                  Type '(err: Error, vm: import("C:/Code/Maximus/src/Maximus.App/node_modules/vue/types/vue").Vue, info: string) => void' is not assignable to type '(err: Error, vm: import("C:/Code/Maximus/src/Maximus.App/node_modules/movue/node_modules/vue/types/vue").Vue, info: string) => void'.
                    Types of parameters 'vm' and 'vm' are incompatible.
                      Type 'Vue' is missing the following properties from type 'Vue': $i18n, $t, $tc, $te, and 6 more.
  Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue>', gave the following error.
    Argument of type '{ install: (Vue: typeof Vue, mobxMethods: IMobxMethods) => void; }' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
      Type '{ install: (Vue: typeof Vue, mobxMethods: IMobxMethods) => void; }' is not assignable to type 'PluginObject<any>'.
        Types of property 'install' are incompatible.
          Type '(Vue: typeof Vue, mobxMethods: IMobxMethods) => void' is not assignable to type 'PluginFunction<any>'.
            Types of parameters 'Vue' and 'Vue' are incompatible.
              Type 'VueConstructor<Vue>' is not assignable to type 'typeof Vue'.

Anyone knows what is the problem?