Vuex + Typescript

Viewed 2059

I am converting a JavaScript project to TypeScript. However I am getting a type error when trying to make Vue use Vuex.

import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

enter image description here

It looks like the problem is that vuex does not provide type definitions like vuejs does?

Because I also have to set

"allowSyntheticDefaultImports": true

in my tsconfig.json.

How can I solve this problem and make Vue.use accept Vuex as the correct type?

1 Answers

I wish I had an better answer, but I ended up deleting node_modules and reinstall them. It appeared to be a mismatch between versions.

Vue / Vuex own typings did take care of everything after I ran a quick package install and upgrade.

Related