6

I'm using vue.js 3, typescript and vuex 4 for my project. But I got this error when using this.$store on my .vue file

Property '$store' does not exist on type 'CreateComponentPublicInstance<{}, {}, { exchanges: Exchange[]; isValidNodeUrl: boolean; isValidSelectedNetworks: boolean; web3: "" | Web3; privateKey: string; jsonKeystore: string; jsonKeystorePassword: string; ... 24 more ...; botIsRunning: boolean; }, ... 14 more ..., {}>'

I have added vuex.d.ts based on this document, but still got the same error https://next.vuex.vuejs.org/guide/typescript-support.html .

import { Store } from "vuex";
import { ComponentCustomProperties } from "vue";

import { State } from "@/interfaces/bot";

declare module "@vue/runtime-core" {
  // Declare your own store states.

  interface ComponentCustomProperties {
    $store: Store<State>;
  }
}

Can somebody help me ?

5

1 Answer 1

-1

check the tsconfig.json. possible there is an error on cannot identify the file.try to add file again by deleting again.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.