diff --git a/docs/pages/en/2.accessor/2.dynamic-modules.md b/docs/pages/en/2.accessor/2.dynamic-modules.md index b9881ae..ebbb41a 100644 --- a/docs/pages/en/2.accessor/2.dynamic-modules.md +++ b/docs/pages/en/2.accessor/2.dynamic-modules.md @@ -73,6 +73,7 @@ for large projects with no able of using `useAccessor` as variable. ```ts{}[store/index.ts] import * as myImportedModule from '~/modules/myImportedModule' import * as myNestedModule from '~/modules/myNestedModule' +import * as myDynamicModuleNoSpread from '~/modules/myImportedModuleNoSpread' export const accessorType = getAccessorType({ state, @@ -83,15 +84,27 @@ export const accessorType = getAccessorType({ submodule: { //add this for module to show as possibly-undefined when using $accessor dynamic: true, + namespaced: true, ...myImportedModule, modules: { myNestedModule, }, }, + //You can add `export const dynamic = true;` inside module so you don't need to use spread operator in that case + //View the example below + submoduleWithoutSpread: myDynamicModuleNoSpread, }, }) ``` +```ts{}[modules/myImportedModuleNoSpread.ts] +export const dynamic = true; + +export const state = () => ({ + //... +}); +``` + ### Modules registration ```ts{}[components/my-component.vue] diff --git a/packages/typed-vuex/src/types/store.ts b/packages/typed-vuex/src/types/store.ts index 1b653e8..9971020 100644 --- a/packages/typed-vuex/src/types/store.ts +++ b/packages/typed-vuex/src/types/store.ts @@ -16,6 +16,7 @@ export interface BlankStore { mutations: {} actions: {} modules: {} + dynamic: boolean } export interface NuxtStore { @@ -24,6 +25,7 @@ export interface NuxtStore { mutations: Record actions: Record modules: NuxtModules + dynamic: boolean } export interface ExtendedNuxtStore extends NuxtStore { @@ -37,6 +39,7 @@ export interface NuxtStoreInput< A, S extends { [key: string]: Partial } > { + dynamic?: boolean namespaced?: boolean state: T getters?: G