Typescript vuex存储在初始化过程中返回到vuex插件的正确类型是什么

Typescript vuex存储在初始化过程中返回到vuex插件的正确类型是什么,typescript,vuex,Typescript,Vuex,商店初始化过程如下所示: /* Logic */ import Vue from 'vue' import Vuex, { StoreOptions } from 'vuex' Vue.use(Vuex) const DataManager = new UserDataManager() type RootStateType = { version: string } const store: StoreOptions<RootStateType> = { // @t

商店初始化过程如下所示:

/* Logic */
import Vue from 'vue'
import Vuex, { StoreOptions } from 'vuex'

Vue.use(Vuex)

const DataManager = new UserDataManager()

type RootStateType = {
  version: string
}

const store: StoreOptions<RootStateType> = {
  // @ts-ignore
  state: {
    version: '1.0.0'
  },
  modules: {...},
  plugins: [DataManager.init()]
}

export default new Vuex.Store<RootStateType>(store)
/*逻辑*/
从“Vue”导入Vue
从“Vuex”导入Vuex,{StoreOptions}
Vue.use(Vuex)
const DataManager=new UserDataManager()
类型RootStateType={
版本:字符串
}
常量存储:存储选项={
//@ts忽略
声明:{
版本:“1.0.0”
},
模块:{…},
插件:[DataManager.init()]
}
导出默认的新Vuex.Store(存储)
…而插件:

export class UserDataManager {
  ... logic

  public init () {
    return (store: <TYPE?>) => {
      store.watch(
        (state: RootStateType) => {
          return [state.user.authentication.id]
        },
        (watched: string[]) => {
          const userID = watched[0]
          ... logic
        }
      )
    }
  }
}
导出类UserDataManager{
思维方式
公共初始化(){
退货(门店:)=>{
商店手表(
(状态:RootStateType)=>{
返回[state.user.authentication.id]
},
(已观看:字符串[])=>{
const userID=wasted[0]
思维方式
}
)
}
}
}
我有点困惑,是否可以在这里传递正确的类型?我试过传递给它:

type storeType = StoreOptions<RootStateType>

...
    return (store: storeType) => {
...
type storeType=StoreOptions
...
退货(门店:门店类型)=>{
...
但它的回报是:
TS2339:类型“StoreOptions”上不存在属性“watch”

如果有人能分享一些关于这个话题的想法,我将不胜感激:-)

偷看一下,并且
商店
应该可以工作。

事实上这就是方法:-)