From d798b2603ab7be644557d310e1d786425dba0ba5 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 17 Oct 2023 17:59:10 +0200 Subject: [PATCH] docs: api update --- .../pinia.DefineSetupStoreOptions.md | 4 +- .../interfaces/pinia.DefineStoreOptions.md | 8 +- .../pinia.DefineStoreOptionsBase.md | 2 +- .../pinia.DefineStoreOptionsInPlugin.md | 4 +- packages/docs/api/interfaces/pinia.Pinia.md | 2 +- .../interfaces/pinia.PiniaCustomProperties.md | 6 +- .../pinia.PiniaCustomStateProperties.md | 2 +- .../docs/api/interfaces/pinia.PiniaPlugin.md | 6 +- .../interfaces/pinia.PiniaPluginContext.md | 8 +- .../api/interfaces/pinia.StoreDefinition.md | 18 +- ...inia.SubscriptionCallbackMutationDirect.md | 2 +- ...bscriptionCallbackMutationPatchFunction.md | 4 +- ...SubscriptionCallbackMutationPatchObject.md | 6 +- .../pinia._StoreOnActionListenerContext.md | 8 +- .../api/interfaces/pinia._StoreWithState.md | 10 +- .../interfaces/pinia_nuxt.ModuleOptions.md | 2 +- .../pinia_testing.TestingOptions.md | 2 +- .../interfaces/pinia_testing.TestingPinia.md | 2 +- packages/docs/api/modules/pinia.md | 166 ++++++++++-------- 19 files changed, 144 insertions(+), 118 deletions(-) diff --git a/packages/docs/api/interfaces/pinia.DefineSetupStoreOptions.md b/packages/docs/api/interfaces/pinia.DefineSetupStoreOptions.md index 0746ac6e..1283d32d 100644 --- a/packages/docs/api/interfaces/pinia.DefineSetupStoreOptions.md +++ b/packages/docs/api/interfaces/pinia.DefineSetupStoreOptions.md @@ -20,13 +20,13 @@ augment stores with the plugin API. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) | | `G` | `G` | | `A` | `A` | ## Hierarchy -- [`DefineStoreOptionsBase`](pinia.DefineStoreOptionsBase.md)<`S`, [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\>\> +- [`DefineStoreOptionsBase`](pinia.DefineStoreOptionsBase.md)<`S`, [`Store`](../modules/pinia.md#Store)<`Id`, `S`, `G`, `A`\>\> ↳ **`DefineSetupStoreOptions`** diff --git a/packages/docs/api/interfaces/pinia.DefineStoreOptions.md b/packages/docs/api/interfaces/pinia.DefineStoreOptions.md index f89955fd..2b53045c 100644 --- a/packages/docs/api/interfaces/pinia.DefineStoreOptions.md +++ b/packages/docs/api/interfaces/pinia.DefineStoreOptions.md @@ -20,13 +20,13 @@ augment stores with the plugin API. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) | | `G` | `G` | | `A` | `A` | ## Hierarchy -- [`DefineStoreOptionsBase`](pinia.DefineStoreOptionsBase.md)<`S`, [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\>\> +- [`DefineStoreOptionsBase`](pinia.DefineStoreOptionsBase.md)<`S`, [`Store`](../modules/pinia.md#Store)<`Id`, `S`, `G`, `A`\>\> ↳ **`DefineStoreOptions`** @@ -34,7 +34,7 @@ augment stores with the plugin API. ### actions -• `Optional` **actions**: `A` & `ThisType`<`A` & `UnwrapRef`<`S`\> & [`_StoreWithState`](pinia._StoreWithState.md)<`Id`, `S`, `G`, `A`\> & [`_StoreWithGetters`](../modules/pinia.md#_storewithgetters)<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), [`_GettersTree`](../modules/pinia.md#_getterstree)<[`StateTree`](../modules/pinia.md#statetree)\>, [`_ActionsTree`](../modules/pinia.md#_actionstree)\>\> +• `Optional` **actions**: `A` & `ThisType`<`A` & `UnwrapRef`<`S`\> & [`_StoreWithState`](pinia._StoreWithState.md)<`Id`, `S`, `G`, `A`\> & [`_StoreWithGetters`](../modules/pinia.md#_StoreWithGetters)<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#StateTree), [`_GettersTree`](../modules/pinia.md#_GettersTree)<[`StateTree`](../modules/pinia.md#StateTree)\>, [`_ActionsTree`](../modules/pinia.md#_ActionsTree)\>\> Optional object of actions. @@ -42,7 +42,7 @@ ___ ### getters -• `Optional` **getters**: `G` & `ThisType`<`UnwrapRef`<`S`\> & [`_StoreWithGetters`](../modules/pinia.md#_storewithgetters)<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), [`_GettersTree`](../modules/pinia.md#_getterstree)<[`StateTree`](../modules/pinia.md#statetree)\>, [`_ActionsTree`](../modules/pinia.md#_actionstree)\>\> & [`_GettersTree`](../modules/pinia.md#_getterstree)<`S`\> +• `Optional` **getters**: `G` & `ThisType`<`UnwrapRef`<`S`\> & [`_StoreWithGetters`](../modules/pinia.md#_StoreWithGetters)<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#StateTree), [`_GettersTree`](../modules/pinia.md#_GettersTree)<[`StateTree`](../modules/pinia.md#StateTree)\>, [`_ActionsTree`](../modules/pinia.md#_ActionsTree)\>\> & [`_GettersTree`](../modules/pinia.md#_GettersTree)<`S`\> Optional object of getters. diff --git a/packages/docs/api/interfaces/pinia.DefineStoreOptionsBase.md b/packages/docs/api/interfaces/pinia.DefineStoreOptionsBase.md index c6fbadba..eae87cd4 100644 --- a/packages/docs/api/interfaces/pinia.DefineStoreOptionsBase.md +++ b/packages/docs/api/interfaces/pinia.DefineStoreOptionsBase.md @@ -16,7 +16,7 @@ of stores. | Name | Type | | :------ | :------ | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) | | `Store` | `Store` | ## Hierarchy diff --git a/packages/docs/api/interfaces/pinia.DefineStoreOptionsInPlugin.md b/packages/docs/api/interfaces/pinia.DefineStoreOptionsInPlugin.md index e6bac956..ef90c8fc 100644 --- a/packages/docs/api/interfaces/pinia.DefineStoreOptionsInPlugin.md +++ b/packages/docs/api/interfaces/pinia.DefineStoreOptionsInPlugin.md @@ -15,7 +15,7 @@ Available `options` when creating a pinia plugin. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) | | `G` | `G` | | `A` | `A` | @@ -39,7 +39,7 @@ ___ ### getters -• `Optional` **getters**: `G` & `ThisType`<`UnwrapRef`<`S`\> & [`_StoreWithGetters`](../modules/pinia.md#_storewithgetters)<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), [`_GettersTree`](../modules/pinia.md#_getterstree)<[`StateTree`](../modules/pinia.md#statetree)\>, [`_ActionsTree`](../modules/pinia.md#_actionstree)\>\> & [`_GettersTree`](../modules/pinia.md#_getterstree)<`S`\> +• `Optional` **getters**: `G` & `ThisType`<`UnwrapRef`<`S`\> & [`_StoreWithGetters`](../modules/pinia.md#_StoreWithGetters)<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#StateTree), [`_GettersTree`](../modules/pinia.md#_GettersTree)<[`StateTree`](../modules/pinia.md#StateTree)\>, [`_ActionsTree`](../modules/pinia.md#_ActionsTree)\>\> & [`_GettersTree`](../modules/pinia.md#_GettersTree)<`S`\> Optional object of getters. diff --git a/packages/docs/api/interfaces/pinia.Pinia.md b/packages/docs/api/interfaces/pinia.Pinia.md index 7dddf2f6..b6809804 100644 --- a/packages/docs/api/interfaces/pinia.Pinia.md +++ b/packages/docs/api/interfaces/pinia.Pinia.md @@ -40,7 +40,7 @@ ___ ### state -• **state**: `Ref`<`Record`<`string`, [`StateTree`](../modules/pinia.md#statetree)\>\> +• **state**: `Ref`<`Record`<`string`, [`StateTree`](../modules/pinia.md#StateTree)\>\> root state diff --git a/packages/docs/api/interfaces/pinia.PiniaCustomProperties.md b/packages/docs/api/interfaces/pinia.PiniaCustomProperties.md index 9fb7e21e..e3fb5435 100644 --- a/packages/docs/api/interfaces/pinia.PiniaCustomProperties.md +++ b/packages/docs/api/interfaces/pinia.PiniaCustomProperties.md @@ -15,6 +15,6 @@ Interface to be extended by the user when they add properties through plugins. | Name | Type | | :------ | :------ | | `Id` | extends `string` = `string` | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) | -| `G` | [`_GettersTree`](../modules/pinia.md#_getterstree)<`S`\> | -| `A` | [`_ActionsTree`](../modules/pinia.md#_actionstree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) = [`StateTree`](../modules/pinia.md#StateTree) | +| `G` | [`_GettersTree`](../modules/pinia.md#_GettersTree)<`S`\> | +| `A` | [`_ActionsTree`](../modules/pinia.md#_ActionsTree) | diff --git a/packages/docs/api/interfaces/pinia.PiniaCustomStateProperties.md b/packages/docs/api/interfaces/pinia.PiniaCustomStateProperties.md index db838f88..cec3cb93 100644 --- a/packages/docs/api/interfaces/pinia.PiniaCustomStateProperties.md +++ b/packages/docs/api/interfaces/pinia.PiniaCustomStateProperties.md @@ -14,4 +14,4 @@ Properties that are added to every `store.$state` by `pinia.use()`. | Name | Type | | :------ | :------ | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) = [`StateTree`](../modules/pinia.md#StateTree) | diff --git a/packages/docs/api/interfaces/pinia.PiniaPlugin.md b/packages/docs/api/interfaces/pinia.PiniaPlugin.md index 2348345c..8a3255b6 100644 --- a/packages/docs/api/interfaces/pinia.PiniaPlugin.md +++ b/packages/docs/api/interfaces/pinia.PiniaPlugin.md @@ -14,7 +14,7 @@ Plugin to extend every store. ### PiniaPlugin -▸ **PiniaPlugin**(`context`): `void` \| `Partial`<[`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), [`_GettersTree`](../modules/pinia.md#_getterstree)<[`StateTree`](../modules/pinia.md#statetree)\>, [`_ActionsTree`](../modules/pinia.md#_actionstree)\> & [`PiniaCustomStateProperties`](pinia.PiniaCustomStateProperties.md)<[`StateTree`](../modules/pinia.md#statetree)\>\> +▸ **PiniaPlugin**(`context`): `void` \| `Partial`<[`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#StateTree), [`_GettersTree`](../modules/pinia.md#_GettersTree)<[`StateTree`](../modules/pinia.md#StateTree)\>, [`_ActionsTree`](../modules/pinia.md#_ActionsTree)\> & [`PiniaCustomStateProperties`](pinia.PiniaCustomStateProperties.md)<[`StateTree`](../modules/pinia.md#StateTree)\>\> Plugin to extend every store. Returns an object to extend the store or nothing. @@ -23,8 +23,8 @@ nothing. | Name | Type | Description | | :------ | :------ | :------ | -| `context` | [`PiniaPluginContext`](pinia.PiniaPluginContext.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), [`_GettersTree`](../modules/pinia.md#_getterstree)<[`StateTree`](../modules/pinia.md#statetree)\>, [`_ActionsTree`](../modules/pinia.md#_actionstree)\> | Context | +| `context` | [`PiniaPluginContext`](pinia.PiniaPluginContext.md)<`string`, [`StateTree`](../modules/pinia.md#StateTree), [`_GettersTree`](../modules/pinia.md#_GettersTree)<[`StateTree`](../modules/pinia.md#StateTree)\>, [`_ActionsTree`](../modules/pinia.md#_ActionsTree)\> | Context | #### Returns -`void` \| `Partial`<[`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), [`_GettersTree`](../modules/pinia.md#_getterstree)<[`StateTree`](../modules/pinia.md#statetree)\>, [`_ActionsTree`](../modules/pinia.md#_actionstree)\> & [`PiniaCustomStateProperties`](pinia.PiniaCustomStateProperties.md)<[`StateTree`](../modules/pinia.md#statetree)\>\> +`void` \| `Partial`<[`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#StateTree), [`_GettersTree`](../modules/pinia.md#_GettersTree)<[`StateTree`](../modules/pinia.md#StateTree)\>, [`_ActionsTree`](../modules/pinia.md#_ActionsTree)\> & [`PiniaCustomStateProperties`](pinia.PiniaCustomStateProperties.md)<[`StateTree`](../modules/pinia.md#StateTree)\>\> diff --git a/packages/docs/api/interfaces/pinia.PiniaPluginContext.md b/packages/docs/api/interfaces/pinia.PiniaPluginContext.md index 7fba91d4..a33b28a9 100644 --- a/packages/docs/api/interfaces/pinia.PiniaPluginContext.md +++ b/packages/docs/api/interfaces/pinia.PiniaPluginContext.md @@ -15,9 +15,9 @@ Context argument passed to Pinia plugins. | Name | Type | | :------ | :------ | | `Id` | extends `string` = `string` | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) | -| `G` | [`_GettersTree`](../modules/pinia.md#_getterstree)<`S`\> | -| `A` | [`_ActionsTree`](../modules/pinia.md#_actionstree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) = [`StateTree`](../modules/pinia.md#StateTree) | +| `G` | [`_GettersTree`](../modules/pinia.md#_GettersTree)<`S`\> | +| `A` | [`_ActionsTree`](../modules/pinia.md#_ActionsTree) | ## Properties @@ -47,6 +47,6 @@ ___ ### store -• **store**: [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\> +• **store**: [`Store`](../modules/pinia.md#Store)<`Id`, `S`, `G`, `A`\> Current store being extended. diff --git a/packages/docs/api/interfaces/pinia.StoreDefinition.md b/packages/docs/api/interfaces/pinia.StoreDefinition.md index 97fae150..093bb474 100644 --- a/packages/docs/api/interfaces/pinia.StoreDefinition.md +++ b/packages/docs/api/interfaces/pinia.StoreDefinition.md @@ -15,15 +15,21 @@ Return type of `defineStore()`. Function that allows instantiating a store. | Name | Type | | :------ | :------ | | `Id` | extends `string` = `string` | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) | -| `G` | [`_GettersTree`](../modules/pinia.md#_getterstree)<`S`\> | -| `A` | [`_ActionsTree`](../modules/pinia.md#_actionstree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) = [`StateTree`](../modules/pinia.md#StateTree) | +| `G` | [`_GettersTree`](../modules/pinia.md#_GettersTree)<`S`\> | +| `A` | [`_ActionsTree`](../modules/pinia.md#_ActionsTree) | + +## Hierarchy + +- **`StoreDefinition`** + + ↳ [`SetupStoreDefinition`](pinia.SetupStoreDefinition.md) ## Callable ### StoreDefinition -▸ **StoreDefinition**(`pinia?`, `hot?`): [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\> +▸ **StoreDefinition**(`pinia?`, `hot?`): [`Store`](../modules/pinia.md#Store)<`Id`, `S`, `G`, `A`\> Returns a store, creates it if necessary. @@ -32,11 +38,11 @@ Returns a store, creates it if necessary. | Name | Type | Description | | :------ | :------ | :------ | | `pinia?` | ``null`` \| [`Pinia`](pinia.Pinia.md) | Pinia instance to retrieve the store | -| `hot?` | [`StoreGeneric`](../modules/pinia.md#storegeneric) | dev only hot module replacement | +| `hot?` | [`StoreGeneric`](../modules/pinia.md#StoreGeneric) | dev only hot module replacement | #### Returns -[`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\> +[`Store`](../modules/pinia.md#Store)<`Id`, `S`, `G`, `A`\> ## Properties diff --git a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationDirect.md b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationDirect.md index b9f0226d..860c3827 100644 --- a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationDirect.md +++ b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationDirect.md @@ -42,7 +42,7 @@ ___ #### Inherited from -[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeid) +[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeId) ___ diff --git a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md index d2d48d49..e023d25f 100644 --- a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md +++ b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md @@ -41,13 +41,13 @@ ___ #### Inherited from -[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeid) +[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeId) ___ ### type -• **type**: [`patchFunction`](../enums/pinia.MutationType.md#patchfunction) +• **type**: [`patchFunction`](../enums/pinia.MutationType.md#patchFunction) Type of the mutation. diff --git a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchObject.md b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchObject.md index 7457ef19..af350533 100644 --- a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchObject.md +++ b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchObject.md @@ -41,7 +41,7 @@ ___ ### payload -• **payload**: [`_DeepPartial`](../modules/pinia.md#_deeppartial)<`S`\> +• **payload**: [`_DeepPartial`](../modules/pinia.md#_DeepPartial)<`S`\> Object passed to `store.$patch()`. @@ -55,13 +55,13 @@ ___ #### Inherited from -[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeid) +[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeId) ___ ### type -• **type**: [`patchObject`](../enums/pinia.MutationType.md#patchobject) +• **type**: [`patchObject`](../enums/pinia.MutationType.md#patchObject) Type of the mutation. diff --git a/packages/docs/api/interfaces/pinia._StoreOnActionListenerContext.md b/packages/docs/api/interfaces/pinia._StoreOnActionListenerContext.md index 6e235ae2..85568eaa 100644 --- a/packages/docs/api/interfaces/pinia._StoreOnActionListenerContext.md +++ b/packages/docs/api/interfaces/pinia._StoreOnActionListenerContext.md @@ -8,7 +8,7 @@ editLink: false [pinia](../modules/pinia.md)._StoreOnActionListenerContext -Actual type for [StoreOnActionListenerContext](../modules/pinia.md#storeonactionlistenercontext). Exists for refactoring +Actual type for [StoreOnActionListenerContext](../modules/pinia.md#StoreOnActionListenerContext). Exists for refactoring purposes. For internal use only. For internal use **only** @@ -24,7 +24,7 @@ For internal use **only** ### after -• **after**: (`callback`: `A` extends `Record`<`ActionName`, [`_Method`](../modules/pinia.md#_method)\> ? (`resolvedReturn`: [`_Awaited`](../modules/pinia.md#_awaited)<`ReturnType`<`A`[`ActionName`]\>\>) => `void` : () => `void`) => `void` +• **after**: (`callback`: `A` extends `Record`<`ActionName`, [`_Method`](../modules/pinia.md#_Method)\> ? (`resolvedReturn`: [`_Awaited`](../modules/pinia.md#_Awaited)<`ReturnType`<`A`[`ActionName`]\>\>) => `void` : () => `void`) => `void` #### Type declaration @@ -37,7 +37,7 @@ of the action, if it's a Promise, it will be unwrapped. | Name | Type | | :------ | :------ | -| `callback` | `A` extends `Record`<`ActionName`, [`_Method`](../modules/pinia.md#_method)\> ? (`resolvedReturn`: [`_Awaited`](../modules/pinia.md#_awaited)<`ReturnType`<`A`[`ActionName`]\>\>) => `void` : () => `void` | +| `callback` | `A` extends `Record`<`ActionName`, [`_Method`](../modules/pinia.md#_Method)\> ? (`resolvedReturn`: [`_Awaited`](../modules/pinia.md#_Awaited)<`ReturnType`<`A`[`ActionName`]\>\>) => `void` : () => `void` | ##### Returns @@ -47,7 +47,7 @@ ___ ### args -• **args**: `A` extends `Record`<`ActionName`, [`_Method`](../modules/pinia.md#_method)\> ? `Parameters`<`A`[`ActionName`]\> : `unknown`[] +• **args**: `A` extends `Record`<`ActionName`, [`_Method`](../modules/pinia.md#_Method)\> ? `Parameters`<`A`[`ActionName`]\> : `unknown`[] Parameters passed to the action diff --git a/packages/docs/api/interfaces/pinia._StoreWithState.md b/packages/docs/api/interfaces/pinia._StoreWithState.md index dfc83c87..a09a1ebe 100644 --- a/packages/docs/api/interfaces/pinia._StoreWithState.md +++ b/packages/docs/api/interfaces/pinia._StoreWithState.md @@ -15,7 +15,7 @@ Base store with state and functions. Should not be used directly. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](../modules/pinia.md#statetree) | +| `S` | extends [`StateTree`](../modules/pinia.md#StateTree) | | `G` | `G` | | `A` | `A` | @@ -57,7 +57,7 @@ that should be displayed in devtools. #### Inherited from -[StoreProperties](pinia.StoreProperties.md).[_customProperties](pinia.StoreProperties.md#_customproperties) +[StoreProperties](pinia.StoreProperties.md).[_customProperties](pinia.StoreProperties.md#_customProperties) ## Methods @@ -100,7 +100,7 @@ up when the component gets unmounted unless `detached` is set to true. | Name | Type | Description | | :------ | :------ | :------ | -| `callback` | [`StoreOnActionListener`](../modules/pinia.md#storeonactionlistener)<`Id`, `S`, `G`, `A`\> | callback called before every action | +| `callback` | [`StoreOnActionListener`](../modules/pinia.md#StoreOnActionListener)<`Id`, `S`, `G`, `A`\> | callback called before every action | | `detached?` | `boolean` | detach the subscription from the context this is called from | #### Returns @@ -177,7 +177,7 @@ Applies a state patch to current state. Allows passing nested values | Name | Type | Description | | :------ | :------ | :------ | -| `partialState` | [`_DeepPartial`](../modules/pinia.md#_deeppartial)<`UnwrapRef`<`S`\>\> | patch to apply to the state | +| `partialState` | [`_DeepPartial`](../modules/pinia.md#_DeepPartial)<`UnwrapRef`<`S`\>\> | patch to apply to the state | #### Returns @@ -232,7 +232,7 @@ component gets unmounted unless `detached` is set to true. | Name | Type | Description | | :------ | :------ | :------ | -| `callback` | [`SubscriptionCallback`](../modules/pinia.md#subscriptioncallback)<`S`\> | callback passed to the watcher | +| `callback` | [`SubscriptionCallback`](../modules/pinia.md#SubscriptionCallback)<`S`\> | callback passed to the watcher | | `options?` | { `detached?`: `boolean` } & `WatchOptions`<`boolean`\> | `watch` options + `detached` to detach the subscription from the context (usually a component) this is called from. Note that the `flush` option does not affect calls to `store.$patch()`. | #### Returns diff --git a/packages/docs/api/interfaces/pinia_nuxt.ModuleOptions.md b/packages/docs/api/interfaces/pinia_nuxt.ModuleOptions.md index 0f61b493..3ba8a0ba 100644 --- a/packages/docs/api/interfaces/pinia_nuxt.ModuleOptions.md +++ b/packages/docs/api/interfaces/pinia_nuxt.ModuleOptions.md @@ -33,4 +33,4 @@ also import nested stores, you can use the glob pattern `./stores/**` **`Default`** -`['./stores']` +`['stores']` diff --git a/packages/docs/api/interfaces/pinia_testing.TestingOptions.md b/packages/docs/api/interfaces/pinia_testing.TestingOptions.md index 1af6d912..7ae2abcb 100644 --- a/packages/docs/api/interfaces/pinia_testing.TestingOptions.md +++ b/packages/docs/api/interfaces/pinia_testing.TestingOptions.md @@ -59,7 +59,7 @@ ___ ### initialState -• `Optional` **initialState**: [`StateTree`](../modules/pinia.md#statetree) +• `Optional` **initialState**: [`StateTree`](../modules/pinia.md#StateTree) Allows defining a partial initial state of all your stores. This state gets applied after a store is created, allowing you to only set a few properties that are required in your test. diff --git a/packages/docs/api/interfaces/pinia_testing.TestingPinia.md b/packages/docs/api/interfaces/pinia_testing.TestingPinia.md index 19403333..b029836a 100644 --- a/packages/docs/api/interfaces/pinia_testing.TestingPinia.md +++ b/packages/docs/api/interfaces/pinia_testing.TestingPinia.md @@ -53,7 +53,7 @@ ___ ### state -• **state**: `Ref`<`Record`<`string`, [`StateTree`](../modules/pinia.md#statetree)\>\> +• **state**: `Ref`<`Record`<`string`, [`StateTree`](../modules/pinia.md#StateTree)\>\> root state diff --git a/packages/docs/api/modules/pinia.md b/packages/docs/api/modules/pinia.md index d12dba89..f0c6607d 100644 --- a/packages/docs/api/modules/pinia.md +++ b/packages/docs/api/modules/pinia.md @@ -22,6 +22,7 @@ editLink: false - [PiniaCustomStateProperties](../interfaces/pinia.PiniaCustomStateProperties.md) - [PiniaPlugin](../interfaces/pinia.PiniaPlugin.md) - [PiniaPluginContext](../interfaces/pinia.PiniaPluginContext.md) +- [SetupStoreDefinition](../interfaces/pinia.SetupStoreDefinition.md) - [StoreDefinition](../interfaces/pinia.StoreDefinition.md) - [StoreProperties](../interfaces/pinia.StoreProperties.md) - [SubscriptionCallbackMutationDirect](../interfaces/pinia.SubscriptionCallbackMutationDirect.md) @@ -55,7 +56,7 @@ ___ ### Store -Ƭ **Store**<`Id`, `S`, `G`, `A`\>: [`_StoreWithState`](../interfaces/pinia._StoreWithState.md)<`Id`, `S`, `G`, `A`\> & `UnwrapRef`<`S`\> & [`_StoreWithGetters`](pinia.md#_storewithgetters)<`G`\> & [`_ActionsTree`](pinia.md#_actionstree) extends `A` ? {} : `A` & [`PiniaCustomProperties`](../interfaces/pinia.PiniaCustomProperties.md)<`Id`, `S`, `G`, `A`\> & [`PiniaCustomStateProperties`](../interfaces/pinia.PiniaCustomStateProperties.md)<`S`\> +Ƭ **Store**<`Id`, `S`, `G`, `A`\>: [`_StoreWithState`](../interfaces/pinia._StoreWithState.md)<`Id`, `S`, `G`, `A`\> & `UnwrapRef`<`S`\> & [`_StoreWithGetters`](pinia.md#_StoreWithGetters)<`G`\> & [`_ActionsTree`](pinia.md#_ActionsTree) extends `A` ? {} : `A` & [`PiniaCustomProperties`](../interfaces/pinia.PiniaCustomProperties.md)<`Id`, `S`, `G`, `A`\> & [`PiniaCustomStateProperties`](../interfaces/pinia.PiniaCustomStateProperties.md)<`S`\> Store type to build a store. @@ -64,7 +65,7 @@ Store type to build a store. | Name | Type | | :------ | :------ | | `Id` | extends `string` = `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) = {} | +| `S` | extends [`StateTree`](pinia.md#StateTree) = {} | | `G` | {} | | `A` | {} | @@ -72,7 +73,7 @@ ___ ### StoreActions -Ƭ **StoreActions**<`SS`\>: `SS` extends [`Store`](pinia.md#store)<`string`, [`StateTree`](pinia.md#statetree), [`_GettersTree`](pinia.md#_getterstree)<[`StateTree`](pinia.md#statetree)\>, infer A\> ? `A` : [`_ExtractActionsFromSetupStore`](pinia.md#_extractactionsfromsetupstore)<`SS`\> +Ƭ **StoreActions**<`SS`\>: `SS` extends [`Store`](pinia.md#Store)<`string`, [`StateTree`](pinia.md#StateTree), [`_GettersTree`](pinia.md#_GettersTree)<[`StateTree`](pinia.md#StateTree)\>, infer A\> ? `A` : [`_ExtractActionsFromSetupStore`](pinia.md#_ExtractActionsFromSetupStore)<`SS`\> Extract the actions of a store type. Works with both a Setup Store or an Options Store. @@ -87,7 +88,7 @@ ___ ### StoreGeneric -Ƭ **StoreGeneric**: [`Store`](pinia.md#store)<`string`, [`StateTree`](pinia.md#statetree), [`_GettersTree`](pinia.md#_getterstree)<[`StateTree`](pinia.md#statetree)\>, [`_ActionsTree`](pinia.md#_actionstree)\> +Ƭ **StoreGeneric**: [`Store`](pinia.md#Store)<`string`, [`StateTree`](pinia.md#StateTree), [`_GettersTree`](pinia.md#_GettersTree)<[`StateTree`](pinia.md#StateTree)\>, [`_ActionsTree`](pinia.md#_ActionsTree)\> Generic and type-unsafe version of Store. Doesn't fail on access with strings, making it much easier to write generic functions that do not care @@ -97,7 +98,7 @@ ___ ### StoreGetters -Ƭ **StoreGetters**<`SS`\>: `SS` extends [`Store`](pinia.md#store)<`string`, [`StateTree`](pinia.md#statetree), infer G, [`_ActionsTree`](pinia.md#_actionstree)\> ? [`_StoreWithGetters`](pinia.md#_storewithgetters)<`G`\> : [`_ExtractGettersFromSetupStore`](pinia.md#_extractgettersfromsetupstore)<`SS`\> +Ƭ **StoreGetters**<`SS`\>: `SS` extends [`Store`](pinia.md#Store)<`string`, [`StateTree`](pinia.md#StateTree), infer G, [`_ActionsTree`](pinia.md#_ActionsTree)\> ? [`_StoreWithGetters`](pinia.md#_StoreWithGetters)<`G`\> : [`_ExtractGettersFromSetupStore`](pinia.md#_ExtractGettersFromSetupStore)<`SS`\> Extract the getters of a store type. Works with both a Setup Store or an Options Store. @@ -112,14 +113,14 @@ ___ ### StoreOnActionListener -Ƭ **StoreOnActionListener**<`Id`, `S`, `G`, `A`\>: (`context`: [`StoreOnActionListenerContext`](pinia.md#storeonactionlistenercontext)<`Id`, `S`, `G`, {} extends `A` ? [`_ActionsTree`](pinia.md#_actionstree) : `A`\>) => `void` +Ƭ **StoreOnActionListener**<`Id`, `S`, `G`, `A`\>: (`context`: [`StoreOnActionListenerContext`](pinia.md#StoreOnActionListenerContext)<`Id`, `S`, `G`, {} extends `A` ? [`_ActionsTree`](pinia.md#_ActionsTree) : `A`\>) => `void` #### Type parameters | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | +| `S` | extends [`StateTree`](pinia.md#StateTree) | | `G` | `G` | | `A` | `A` | @@ -133,7 +134,7 @@ Argument of `store.$onAction()` | Name | Type | | :------ | :------ | -| `context` | [`StoreOnActionListenerContext`](pinia.md#storeonactionlistenercontext)<`Id`, `S`, `G`, {} extends `A` ? [`_ActionsTree`](pinia.md#_actionstree) : `A`\> | +| `context` | [`StoreOnActionListenerContext`](pinia.md#StoreOnActionListenerContext)<`Id`, `S`, `G`, {} extends `A` ? [`_ActionsTree`](pinia.md#_ActionsTree) : `A`\> | ##### Returns @@ -143,7 +144,7 @@ ___ ### StoreOnActionListenerContext -Ƭ **StoreOnActionListenerContext**<`Id`, `S`, `G`, `A`\>: [`_ActionsTree`](pinia.md#_actionstree) extends `A` ? [`_StoreOnActionListenerContext`](../interfaces/pinia._StoreOnActionListenerContext.md)<[`StoreGeneric`](pinia.md#storegeneric), `string`, [`_ActionsTree`](pinia.md#_actionstree)\> : { [Name in keyof A]: Name extends string ? \_StoreOnActionListenerContext, Name, A\> : never }[keyof `A`] +Ƭ **StoreOnActionListenerContext**<`Id`, `S`, `G`, `A`\>: [`_ActionsTree`](pinia.md#_ActionsTree) extends `A` ? [`_StoreOnActionListenerContext`](../interfaces/pinia._StoreOnActionListenerContext.md)<[`StoreGeneric`](pinia.md#StoreGeneric), `string`, [`_ActionsTree`](pinia.md#_ActionsTree)\> : { [Name in keyof A]: Name extends string ? \_StoreOnActionListenerContext, Name, A\> : never }[keyof `A`] Context object passed to callbacks of `store.$onAction(context => {})` TODO: should have only the Id, the Store and Actions to generate the proper object @@ -153,7 +154,7 @@ TODO: should have only the Id, the Store and Actions to generate the proper obje | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | +| `S` | extends [`StateTree`](pinia.md#StateTree) | | `G` | `G` | | `A` | `A` | @@ -161,7 +162,7 @@ ___ ### StoreState -Ƭ **StoreState**<`SS`\>: `SS` extends [`Store`](pinia.md#store)<`string`, infer S, [`_GettersTree`](pinia.md#_getterstree)<[`StateTree`](pinia.md#statetree)\>, [`_ActionsTree`](pinia.md#_actionstree)\> ? `UnwrapRef`<`S`\> : [`_ExtractStateFromSetupStore`](pinia.md#_extractstatefromsetupstore)<`SS`\> +Ƭ **StoreState**<`SS`\>: `SS` extends [`Store`](pinia.md#Store)<`string`, infer S, [`_GettersTree`](pinia.md#_GettersTree)<[`StateTree`](pinia.md#StateTree)\>, [`_ActionsTree`](pinia.md#_ActionsTree)\> ? `UnwrapRef`<`S`\> : [`_ExtractStateFromSetupStore`](pinia.md#_ExtractStateFromSetupStore)<`SS`\> Extract the state of a store type. Works with both a Setup Store or an Options Store. Note this unwraps refs. @@ -176,7 +177,7 @@ ___ ### SubscriptionCallback -Ƭ **SubscriptionCallback**<`S`\>: (`mutation`: [`SubscriptionCallbackMutation`](pinia.md#subscriptioncallbackmutation)<`S`\>, `state`: `UnwrapRef`<`S`\>) => `void` +Ƭ **SubscriptionCallback**<`S`\>: (`mutation`: [`SubscriptionCallbackMutation`](pinia.md#SubscriptionCallbackMutation)<`S`\>, `state`: `UnwrapRef`<`S`\>) => `void` #### Type parameters @@ -194,7 +195,7 @@ Callback of a subscription | Name | Type | | :------ | :------ | -| `mutation` | [`SubscriptionCallbackMutation`](pinia.md#subscriptioncallbackmutation)<`S`\> | +| `mutation` | [`SubscriptionCallbackMutation`](pinia.md#SubscriptionCallbackMutation)<`S`\> | | `state` | `UnwrapRef`<`S`\> | ##### Returns @@ -219,7 +220,7 @@ ___ ### \_ActionsTree -Ƭ **\_ActionsTree**: `Record`<`string`, [`_Method`](pinia.md#_method)\> +Ƭ **\_ActionsTree**: `Record`<`string`, [`_Method`](pinia.md#_Method)\> Type of an object of Actions. For internal usage only. For internal use **only** @@ -228,7 +229,7 @@ ___ ### \_Awaited -Ƭ **\_Awaited**<`T`\>: `T` extends ``null`` \| `undefined` ? `T` : `T` extends `object` & { `then`: (`onfulfilled`: `F`) => `any` } ? `F` extends (`value`: infer V, ...`args`: `any`) => `any` ? [`_Awaited`](pinia.md#_awaited)<`V`\> : `never` : `T` +Ƭ **\_Awaited**<`T`\>: `T` extends ``null`` \| `undefined` ? `T` : `T` extends `object` & { `then`: (`onfulfilled`: `F`) => `any` } ? `F` extends (`value`: infer V, ...`args`: `any`) => `any` ? [`_Awaited`](pinia.md#_Awaited)<`V`\> : `never` : `T` #### Type parameters @@ -242,7 +243,7 @@ ___ Ƭ **\_DeepPartial**<`T`\>: { [K in keyof T]?: \_DeepPartial } -Recursive `Partial`. Used by [['$patch']](pinia.md#store). +Recursive `Partial`. Used by [['$patch']](pinia.md#Store). For internal use **only** @@ -256,7 +257,7 @@ ___ ### \_ExtractActionsFromSetupStore -Ƭ **\_ExtractActionsFromSetupStore**<`SS`\>: `SS` extends `undefined` \| `void` ? {} : [`_ExtractActionsFromSetupStore_Keys`](pinia.md#_extractactionsfromsetupstore_keys)<`SS`\> extends keyof `SS` ? `Pick`<`SS`, [`_ExtractActionsFromSetupStore_Keys`](pinia.md#_extractactionsfromsetupstore_keys)<`SS`\>\> : `never` +Ƭ **\_ExtractActionsFromSetupStore**<`SS`\>: `SS` extends `undefined` \| `void` ? {} : [`_ExtractActionsFromSetupStore_Keys`](pinia.md#_ExtractActionsFromSetupStore_Keys)<`SS`\> extends keyof `SS` ? `Pick`<`SS`, [`_ExtractActionsFromSetupStore_Keys`](pinia.md#_ExtractActionsFromSetupStore_Keys)<`SS`\>\> : `never` For internal use **only** @@ -285,7 +286,7 @@ ___ ### \_ExtractGettersFromSetupStore -Ƭ **\_ExtractGettersFromSetupStore**<`SS`\>: `SS` extends `undefined` \| `void` ? {} : [`_ExtractGettersFromSetupStore_Keys`](pinia.md#_extractgettersfromsetupstore_keys)<`SS`\> extends keyof `SS` ? `Pick`<`SS`, [`_ExtractGettersFromSetupStore_Keys`](pinia.md#_extractgettersfromsetupstore_keys)<`SS`\>\> : `never` +Ƭ **\_ExtractGettersFromSetupStore**<`SS`\>: `SS` extends `undefined` \| `void` ? {} : [`_ExtractGettersFromSetupStore_Keys`](pinia.md#_ExtractGettersFromSetupStore_Keys)<`SS`\> extends keyof `SS` ? `Pick`<`SS`, [`_ExtractGettersFromSetupStore_Keys`](pinia.md#_ExtractGettersFromSetupStore_Keys)<`SS`\>\> : `never` For internal use **only** @@ -314,7 +315,7 @@ ___ ### \_ExtractStateFromSetupStore -Ƭ **\_ExtractStateFromSetupStore**<`SS`\>: `SS` extends `undefined` \| `void` ? {} : [`_ExtractStateFromSetupStore_Keys`](pinia.md#_extractstatefromsetupstore_keys)<`SS`\> extends keyof `SS` ? [`_UnwrapAll`](pinia.md#_unwrapall)<`Pick`<`SS`, [`_ExtractStateFromSetupStore_Keys`](pinia.md#_extractstatefromsetupstore_keys)<`SS`\>\>\> : `never` +Ƭ **\_ExtractStateFromSetupStore**<`SS`\>: `SS` extends `undefined` \| `void` ? {} : [`_ExtractStateFromSetupStore_Keys`](pinia.md#_ExtractStateFromSetupStore_Keys)<`SS`\> extends keyof `SS` ? [`_UnwrapAll`](pinia.md#_UnwrapAll)<`Pick`<`SS`, [`_ExtractStateFromSetupStore_Keys`](pinia.md#_ExtractStateFromSetupStore_Keys)<`SS`\>\>\> : `never` For internal use **only** @@ -352,7 +353,7 @@ For internal use **only** | Name | Type | | :------ | :------ | -| `S` | extends [`StateTree`](pinia.md#statetree) | +| `S` | extends [`StateTree`](pinia.md#StateTree) | ___ @@ -396,10 +397,10 @@ For internal use **only** | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | -| `T` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#store)<`Id`, `S`, `G`, `A`\>) => `any`\> = {} | +| `T` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#Store)<`Id`, `S`, `G`, `A`\>) => `any`\> = {} | ___ @@ -413,8 +414,8 @@ For internal use **only** | Name | Type | | :------ | :------ | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `Keys` | extends keyof `S` \| keyof `G` = keyof `S` \| keyof `G` | ___ @@ -429,7 +430,7 @@ For internal use **only** | Name | Type | | :------ | :------ | -| `S` | extends [`StateTree`](pinia.md#statetree) | +| `S` | extends [`StateTree`](pinia.md#StateTree) | | `T` | extends `Record`<`string`, keyof `S`\> | ___ @@ -444,7 +445,7 @@ For internal use **only** | Name | Type | | :------ | :------ | -| `S` | extends [`StateTree`](pinia.md#statetree) | +| `S` | extends [`StateTree`](pinia.md#StateTree) | ___ @@ -474,7 +475,7 @@ ___ ### \_Spread -Ƭ **\_Spread**<`A`\>: `A` extends [infer L, ...(infer R)] ? [`_StoreObject`](pinia.md#_storeobject)<`L`\> & [`_Spread`](pinia.md#_spread)<`R`\> : `unknown` +Ƭ **\_Spread**<`A`\>: `A` extends [infer L, ...(infer R)] ? [`_StoreObject`](pinia.md#_StoreObject)<`L`\> & [`_Spread`](pinia.md#_Spread)<`R`\> : `unknown` For internal use **only**. @@ -586,9 +587,9 @@ Creates an _accept_ function to pass to `import.meta.hot` in Vite applications. | Name | Type | | :------ | :------ | | `Id` | extends `string` = `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) = [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> = [`_GettersTree`](pinia.md#_getterstree)<`S`\> | -| `A` | [`_ActionsTree`](pinia.md#_actionstree) | +| `S` | extends [`StateTree`](pinia.md#StateTree) = [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> = [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | +| `A` | [`_ActionsTree`](pinia.md#_ActionsTree) | #### Parameters @@ -647,8 +648,8 @@ Creates a `useStore` function that retrieves the store instance | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) = {} | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> = {} | +| `S` | extends [`StateTree`](pinia.md#StateTree) = {} | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> = {} | | `A` | {} | #### Parameters @@ -671,8 +672,8 @@ Creates a `useStore` function that retrieves the store instance | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) = {} | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> = {} | +| `S` | extends [`StateTree`](pinia.md#StateTree) = {} | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> = {} | | `A` | {} | #### Parameters @@ -685,7 +686,7 @@ Creates a `useStore` function that retrieves the store instance [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> -▸ **defineStore**<`Id`, `SS`\>(`id`, `storeSetup`, `options?`): [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, [`_ExtractStateFromSetupStore`](pinia.md#_extractstatefromsetupstore)<`SS`\>, [`_ExtractGettersFromSetupStore`](pinia.md#_extractgettersfromsetupstore)<`SS`\>, [`_ExtractActionsFromSetupStore`](pinia.md#_extractactionsfromsetupstore)<`SS`\>\> +▸ **defineStore**<`Id`, `SS`\>(`id`, `storeSetup`, `options?`): [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, [`_ExtractStateFromSetupStore`](pinia.md#_ExtractStateFromSetupStore)<`SS`\>, [`_ExtractGettersFromSetupStore`](pinia.md#_ExtractGettersFromSetupStore)<`SS`\>, [`_ExtractActionsFromSetupStore`](pinia.md#_ExtractActionsFromSetupStore)<`SS`\>\> Creates a `useStore` function that retrieves the store instance @@ -702,11 +703,30 @@ Creates a `useStore` function that retrieves the store instance | :------ | :------ | :------ | | `id` | `Id` | id of the store (must be unique) | | `storeSetup` | () => `SS` | function that defines the store | -| `options?` | [`DefineSetupStoreOptions`](../interfaces/pinia.DefineSetupStoreOptions.md)<`Id`, [`_ExtractStateFromSetupStore`](pinia.md#_extractstatefromsetupstore)<`SS`\>, [`_ExtractGettersFromSetupStore`](pinia.md#_extractgettersfromsetupstore)<`SS`\>, [`_ExtractActionsFromSetupStore`](pinia.md#_extractactionsfromsetupstore)<`SS`\>\> | extra options | +| `options?` | [`DefineSetupStoreOptions`](../interfaces/pinia.DefineSetupStoreOptions.md)<`Id`, [`_ExtractStateFromSetupStore`](pinia.md#_ExtractStateFromSetupStore)<`SS`\>, [`_ExtractGettersFromSetupStore`](pinia.md#_ExtractGettersFromSetupStore)<`SS`\>, [`_ExtractActionsFromSetupStore`](pinia.md#_ExtractActionsFromSetupStore)<`SS`\>\> | extra options | #### Returns -[`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, [`_ExtractStateFromSetupStore`](pinia.md#_extractstatefromsetupstore)<`SS`\>, [`_ExtractGettersFromSetupStore`](pinia.md#_extractgettersfromsetupstore)<`SS`\>, [`_ExtractActionsFromSetupStore`](pinia.md#_extractactionsfromsetupstore)<`SS`\>\> +[`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, [`_ExtractStateFromSetupStore`](pinia.md#_ExtractStateFromSetupStore)<`SS`\>, [`_ExtractGettersFromSetupStore`](pinia.md#_ExtractGettersFromSetupStore)<`SS`\>, [`_ExtractActionsFromSetupStore`](pinia.md#_ExtractActionsFromSetupStore)<`SS`\>\> + +___ + +### disposePinia + +▸ **disposePinia**(`pinia`): `void` + +Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly +useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `pinia` | [`Pinia`](../interfaces/pinia.Pinia.md) | pinia instance | + +#### Returns + +`void` ___ @@ -724,7 +744,7 @@ ___ ### mapActions -▸ **mapActions**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapActionsObjectReturn`](pinia.md#_mapactionsobjectreturn)<`A`, `KeyMapper`\> +▸ **mapActions**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapActionsObjectReturn`](pinia.md#_MapActionsObjectReturn)<`A`, `KeyMapper`\> Allows directly using actions from your store without using the composition API (`setup()`) by generating an object to be spread in the `methods` field @@ -736,8 +756,8 @@ the names of the resulting methods. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | | `KeyMapper` | extends `Record`<`string`, keyof `A`\> | @@ -750,7 +770,7 @@ the names of the resulting methods. #### Returns -[`_MapActionsObjectReturn`](pinia.md#_mapactionsobjectreturn)<`A`, `KeyMapper`\> +[`_MapActionsObjectReturn`](pinia.md#_MapActionsObjectReturn)<`A`, `KeyMapper`\> **`Example`** @@ -769,7 +789,7 @@ export default { } ``` -▸ **mapActions**<`Id`, `S`, `G`, `A`\>(`useStore`, `keys`): [`_MapActionsReturn`](pinia.md#_mapactionsreturn)<`A`\> +▸ **mapActions**<`Id`, `S`, `G`, `A`\>(`useStore`, `keys`): [`_MapActionsReturn`](pinia.md#_MapActionsReturn)<`A`\> Allows directly using actions from your store without using the composition API (`setup()`) by generating an object to be spread in the `methods` field @@ -780,8 +800,8 @@ of a component. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | #### Parameters @@ -793,7 +813,7 @@ of a component. #### Returns -[`_MapActionsReturn`](pinia.md#_mapactionsreturn)<`A`\> +[`_MapActionsReturn`](pinia.md#_MapActionsReturn)<`A`\> **`Example`** @@ -815,7 +835,7 @@ ___ ### mapGetters -▸ **mapGetters**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapStateObjectReturn`](pinia.md#_mapstateobjectreturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> +▸ **mapGetters**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapStateObjectReturn`](pinia.md#_MapStateObjectReturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> Alias for `mapState()`. You should use `mapState()` instead. @@ -824,10 +844,10 @@ Alias for `mapState()`. You should use `mapState()` instead. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | -| `KeyMapper` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#store)<`Id`, `S`, `G`, `A`\>) => `any`\> | +| `KeyMapper` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#Store)<`Id`, `S`, `G`, `A`\>) => `any`\> | #### Parameters @@ -838,13 +858,13 @@ Alias for `mapState()`. You should use `mapState()` instead. #### Returns -[`_MapStateObjectReturn`](pinia.md#_mapstateobjectreturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> +[`_MapStateObjectReturn`](pinia.md#_MapStateObjectReturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> **`Deprecated`** use `mapState()` instead. -▸ **mapGetters**<`Id`, `S`, `G`, `A`, `Keys`\>(`useStore`, `keys`): [`_MapStateReturn`](pinia.md#_mapstatereturn)<`S`, `G`, `Keys`\> +▸ **mapGetters**<`Id`, `S`, `G`, `A`, `Keys`\>(`useStore`, `keys`): [`_MapStateReturn`](pinia.md#_MapStateReturn)<`S`, `G`, `Keys`\> Alias for `mapState()`. You should use `mapState()` instead. @@ -853,8 +873,8 @@ Alias for `mapState()`. You should use `mapState()` instead. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | | `Keys` | extends `string` \| `number` \| `symbol` | @@ -867,7 +887,7 @@ Alias for `mapState()`. You should use `mapState()` instead. #### Returns -[`_MapStateReturn`](pinia.md#_mapstatereturn)<`S`, `G`, `Keys`\> +[`_MapStateReturn`](pinia.md#_MapStateReturn)<`S`, `G`, `Keys`\> **`Deprecated`** @@ -877,7 +897,7 @@ ___ ### mapState -▸ **mapState**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapStateObjectReturn`](pinia.md#_mapstateobjectreturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> +▸ **mapState**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapStateObjectReturn`](pinia.md#_MapStateObjectReturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> Allows using state and getters from one store without using the composition API (`setup()`) by generating an object to be spread in the `computed` field @@ -892,10 +912,10 @@ instance via `this`, it won't be typed. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | -| `KeyMapper` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#store)<`Id`, `S`, `G`, `A`\>) => `any`\> | +| `KeyMapper` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#Store)<`Id`, `S`, `G`, `A`\>) => `any`\> | #### Parameters @@ -906,7 +926,7 @@ instance via `this`, it won't be typed. #### Returns -[`_MapStateObjectReturn`](pinia.md#_mapstateobjectreturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> +[`_MapStateObjectReturn`](pinia.md#_MapStateObjectReturn)<`Id`, `S`, `G`, `A`, `KeyMapper`\> **`Example`** @@ -933,7 +953,7 @@ export default { } ``` -▸ **mapState**<`Id`, `S`, `G`, `A`, `Keys`\>(`useStore`, `keys`): [`_MapStateReturn`](pinia.md#_mapstatereturn)<`S`, `G`, `Keys`\> +▸ **mapState**<`Id`, `S`, `G`, `A`, `Keys`\>(`useStore`, `keys`): [`_MapStateReturn`](pinia.md#_MapStateReturn)<`S`, `G`, `Keys`\> Allows using state and getters from one store without using the composition API (`setup()`) by generating an object to be spread in the `computed` field @@ -944,8 +964,8 @@ of a component. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | | `Keys` | extends `string` \| `number` \| `symbol` | @@ -958,7 +978,7 @@ of a component. #### Returns -[`_MapStateReturn`](pinia.md#_mapstatereturn)<`S`, `G`, `Keys`\> +[`_MapStateReturn`](pinia.md#_MapStateReturn)<`S`, `G`, `Keys`\> **`Example`** @@ -980,7 +1000,7 @@ ___ ### mapStores -▸ **mapStores**<`Stores`\>(`...stores`): [`_Spread`](pinia.md#_spread)<`Stores`\> +▸ **mapStores**<`Stores`\>(`...stores`): [`_Spread`](pinia.md#_Spread)<`Stores`\> Allows using stores without the composition API (`setup()`) by generating an object to be spread in the `computed` field of a component. It accepts a list @@ -1000,7 +1020,7 @@ of store definitions. #### Returns -[`_Spread`](pinia.md#_spread)<`Stores`\> +[`_Spread`](pinia.md#_Spread)<`Stores`\> **`Example`** @@ -1022,7 +1042,7 @@ ___ ### mapWritableState -▸ **mapWritableState**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapWritableStateObjectReturn`](pinia.md#_mapwritablestateobjectreturn)<`S`, `KeyMapper`\> +▸ **mapWritableState**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): [`_MapWritableStateObjectReturn`](pinia.md#_MapWritableStateObjectReturn)<`S`, `KeyMapper`\> Same as `mapState()` but creates computed setters as well so the state can be modified. Differently from `mapState()`, only `state` properties can be @@ -1033,8 +1053,8 @@ added. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | | `KeyMapper` | extends `Record`<`string`, keyof `S`\> | @@ -1047,7 +1067,7 @@ added. #### Returns -[`_MapWritableStateObjectReturn`](pinia.md#_mapwritablestateobjectreturn)<`S`, `KeyMapper`\> +[`_MapWritableStateObjectReturn`](pinia.md#_MapWritableStateObjectReturn)<`S`, `KeyMapper`\> ▸ **mapWritableState**<`Id`, `S`, `G`, `A`, `Keys`\>(`useStore`, `keys`): { [K in Keys]: Object } @@ -1060,8 +1080,8 @@ of a component. | Name | Type | | :------ | :------ | | `Id` | extends `string` | -| `S` | extends [`StateTree`](pinia.md#statetree) | -| `G` | extends [`_GettersTree`](pinia.md#_getterstree)<`S`\> | +| `S` | extends [`StateTree`](pinia.md#StateTree) | +| `G` | extends [`_GettersTree`](pinia.md#_GettersTree)<`S`\> | | `A` | `A` | | `Keys` | extends `string` \| `number` \| `symbol` | @@ -1187,7 +1207,7 @@ completely ignored. | Name | Type | | :------ | :------ | -| `SS` | extends [`_StoreWithState`](../interfaces/pinia._StoreWithState.md)<`string`, [`StateTree`](pinia.md#statetree), [`_GettersTree`](pinia.md#_getterstree)<[`StateTree`](pinia.md#statetree)\>, [`_ActionsTree`](pinia.md#_actionstree), `SS`\> & [`StateTree`](pinia.md#statetree) & [`_StoreWithGetters`](pinia.md#_storewithgetters)<[`_GettersTree`](pinia.md#_getterstree)<[`StateTree`](pinia.md#statetree)\>\> & [`PiniaCustomProperties`](../interfaces/pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](pinia.md#statetree), [`_GettersTree`](pinia.md#_getterstree)<[`StateTree`](pinia.md#statetree)\>, [`_ActionsTree`](pinia.md#_actionstree), `SS`\> & [`PiniaCustomStateProperties`](../interfaces/pinia.PiniaCustomStateProperties.md)<[`StateTree`](pinia.md#statetree), `SS`\> | +| `SS` | extends [`StoreGeneric`](pinia.md#StoreGeneric) | #### Parameters -- 2.47.2