Skip to content

Commit d5bd162

Browse files
committed
docs: add description to the action helper
1 parent 4b324cc commit d5bd162

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/pinia/src/store.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,15 @@ export type StoreState<SS> =
780780
: _ExtractStateFromSetupStore<SS>
781781

782782
export interface SetupStoreHelpers {
783-
action: <Fn extends _Method>(fn: Fn) => Fn
783+
/**
784+
* Helper that wraps function so it can be tracked with $onAction when the
785+
* action is called **within the store**. This helper is rarely needed in
786+
* applications. It's intended for advanced use cases like Pinia Colada.
787+
*
788+
* @param fn - action to wrap
789+
* @param name - name of the action. Will be picked up by the store at creation
790+
*/
791+
action: <Fn extends _Method>(fn: Fn, name?: string) => Fn
784792
}
785793

786794
/**

0 commit comments

Comments
 (0)