diff --git a/types/index.d.ts b/types/index.d.ts
index aeb69617f..69ee03a9a 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -24,14 +24,11 @@ export declare class Store {
subscribeAction
(fn: SubscribeActionOptions
, options?: SubscribeOptions): () => void;
watch(getter: (state: S, getters: any) => T, cb: (value: T, oldValue: T) => void, options?: WatchOptions): () => void;
- registerModule(path: string, module: Module, options?: ModuleOptions): void;
- registerModule(path: string[], module: Module, options?: ModuleOptions): void;
+ registerModule(path: string | string[], module: Module, options?: ModuleOptions): void;
- unregisterModule(path: string): void;
- unregisterModule(path: string[]): void;
+ unregisterModule(path: string | string[]): void;
- hasModule(path: string): boolean;
- hasModule(path: string[]): boolean;
+ hasModule(path: string | string[]): boolean;
hotUpdate(options: {
actions?: ActionTree;
diff --git a/types/test/index.ts b/types/test/index.ts
index 32d5ec2c6..a03bdff11 100644
--- a/types/test/index.ts
+++ b/types/test/index.ts
@@ -342,6 +342,10 @@ namespace RegisterModule {
};
}
+ function getInsideModulePath(): string | string[] {
+ return Math.random() > 0.5 ? ["c"] : "c"
+ }
+
const store = new Vuex.Store({
state: {
value: 0
@@ -364,6 +368,12 @@ namespace RegisterModule {
store.hasModule(['a', 'b'])
+ store.registerModule(getInsideModulePath(), {
+ state: {value: 3}
+ })
+
+ store.hasModule(getInsideModulePath())
+
store.unregisterModule(["a", "b"]);
store.unregisterModule("a");
}