Vuex + Typescript

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

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

Vue.use(Vuex);

enter image description here

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

Because I also need to install

"allowSyntheticDefaultImports": true

in my tsconfig.json.

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

+4
source share
1 answer

I would like to get a better answer, but in the end I uninstalled node_modules and reinstalled them. It was a mismatch between versions.

Vue / Vuex's own typing took care of everything after I quickly installed and updated the package.

0
source

Source: https://habr.com/ru/post/1682848/


All Articles