Currently, I am working on a project using Vue 3 and TypeScript.
One issue I am facing is related to vuex. I have created a file named vuex.d.ts
to access $store
inside Components:
import { Store } from 'vuex';
import { State } from '@/store';
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$store: Store<State>
}
}
However, I encounter an error in the file where I am creating the store when this additional file exists.
TS2305: Module '"vuex"' has no exported member 'createStore'.
I am using PhpStorm and noticed that when I click on the vuex
import with Ctrl, two type declarations are displayed - the original one and my vuex.d.ts
. How can I resolve this error and successfully access $store
inside components?