@pinia/root / pinia / defineStore
defineStore()
Call Signature
function defineStore<Id, S, G, A>(id, options): StoreDefinition<Id, S, G, A>Creates a useStore function that retrieves the store instance
Type Parameters
• Id extends string
• S extends StateTree = {}
• G extends _GettersTree<S> = {}
• A = {}
Parameters
id
Id
id of the store (must be unique)
options
Omit<DefineStoreOptions<Id, S, G, A>, "id">
options to define the store
Returns
StoreDefinition<Id, S, G, A>
Call Signature
function defineStore<Id, SS>(
id,
storeSetup,
options?): StoreDefinition<Id, _ExtractStateFromSetupStore<SS>, _ExtractGettersFromSetupStore<SS>, _ExtractActionsFromSetupStore<SS>>Creates a useStore function that retrieves the store instance
Type Parameters
• Id extends string
• SS
Parameters
id
Id
id of the store (must be unique)
storeSetup
(helpers) => SS
function that defines the store
options?
DefineSetupStoreOptions<Id, _ExtractStateFromSetupStore<SS>, _ExtractGettersFromSetupStore<SS>, _ExtractActionsFromSetupStore<SS>>
extra options
Returns
StoreDefinition<Id, _ExtractStateFromSetupStore<SS>, _ExtractGettersFromSetupStore<SS>, _ExtractActionsFromSetupStore<SS>>

