vuex-typescript-interface
vuex-typescript-interface copied to clipboard
Reference to Other Modules
trafficstars
In theory, given that the modules are not namespaced, I should be able to access them from anywhere, so give:
interface UserStore {
[SET_USER](user: User): void
[details: number]: User;
}
interface CurrentUserStore {
currentUserId: number,
[SET_CURRENT_USER](user_id: number): void
[CLEAR_CURRENT_USER](): void
[LOG_IN](payload: LoginRequest): Promise<User|ApiLoginError>
}
interface MyStore {
modules: {
user: UserStore,
currentUser: CurrentUserStore,
}
}
The LOG_IN action should be able to access SET_USER, but it doesn't seem to be available to me in the typings. Maybe I'm just missing something here?
I was able to get it to work by adding { root: true }. But that shouldn't be necessary, right?
That's true - thanks for bringing it up