Open xornet-sl opened 2 years ago
This library does not provide typing of the global $store
option.
In order to get your module with all types you either have to use Component Mapper or Composable Function or context
import Vue from 'vue'
import { foo } from '@/store/modules/foo'
export default Vue.extend({
mounted() {
const typedFooModule = foo.context(this.$store)
// Call `increment` action
typedFooModule.actions.increment(1)
}
})
I'm using version 1.0.0 with vue 3 and vuex 4. TS 4.1.6 When I'm direct-importing created store and trying to use it just like in documentation - everything is totally fine. But I want to register it in all components and use my store in methods using
this.$store
. When I try to do that I don't see any $store registered (but store was used bycreateApp().use(store)
inindex.ts
). I don't know why but this code fromglobal.d.ts
doesn't work automatically:And even if I add this code manually in my store's
index.ts
, I don't get any typing inthis.$store
just because $store is Store<unknown>createComposable
works just fine but I don't like to usesetup()
everywhere...