Tim Hutchison
Tim Hutchison

Reputation: 3633

Error with Vue.use(Vuex) Typescript

I have used npm to install both vue (2.4.2) and vuex (2.3.1). When I try to compile the below code I get the error:

enter image description here

Store.ts

import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);  // Error is thrown here

export default new Vuex.Store({
  // store here
})

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "lib": [
      "es2015",
      "dom",
      "es2015.promise"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "noImplicitAny": false,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5"

  },
  "exclude": [
    "./node_modules",
    "wwwroot",
    "./Model"
  ],
  "include": [
    "./CCSEQ",
    "./WebResources",
    "./sfc.d.ts"
  ]
}

I have seen this question, but doesn't have much helpful in it.

Why am I getting this error and how can I resolve it?

Upvotes: 0

Views: 710

Answers (1)

Marek Krzeminski
Marek Krzeminski

Reputation: 1398

I found a solution. My vuex version was set to 2.3.1. As soon as I upgraded to use 3.0.1 then this problem went away.

Upvotes: 1

Related Questions