@plyaz/types 1.45.3 → 1.45.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/store/types.d.ts +22 -0
- package/package.json +1 -1
package/dist/store/types.d.ts
CHANGED
|
@@ -152,3 +152,25 @@ export interface RootStoreHook {
|
|
|
152
152
|
/** Set state (optional, for store mutations) */
|
|
153
153
|
setState?: (partial: Partial<RootStoreSlice> | ((state: RootStoreSlice) => Partial<RootStoreSlice>)) => void;
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Generic type for Zustand slice set function.
|
|
157
|
+
* Used in slice factory functions to type the set parameter.
|
|
158
|
+
*
|
|
159
|
+
* @typeParam TSlice - The store slice type
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* function createMySlice(
|
|
164
|
+
* set: SliceSetFn<MySlice>,
|
|
165
|
+
* get: SliceGetFn<MySlice>
|
|
166
|
+
* ): MySlice { ... }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export type SliceSetFn<TSlice> = (fn: (state: TSlice) => Partial<TSlice>) => void;
|
|
170
|
+
/**
|
|
171
|
+
* Generic type for Zustand slice get function.
|
|
172
|
+
* Used in slice factory functions to type the get parameter.
|
|
173
|
+
*
|
|
174
|
+
* @typeParam TSlice - The store slice type
|
|
175
|
+
*/
|
|
176
|
+
export type SliceGetFn<TSlice> = () => TSlice;
|
package/package.json
CHANGED