define-zustand 3.0.1 → 3.0.2

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.
Files changed (2) hide show
  1. package/dist/types.d.ts +7 -7
  2. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { StoreApi as ZStoreApi } from 'zustand';
2
+ export type defGetterStateType<S> = Record<string, (state: S) => any>;
3
+ export type ExtraGetterState<S, G extends defGetterStateType<S>> = {
4
+ [key in keyof G]: ReturnType<G[key]>;
5
+ };
2
6
  export type StoreApi<S> = Omit<ZStoreApi<S>, 'setState'> & {
3
7
  setState: (updater: ((state: S) => void) | Partial<S>, replace?: boolean) => void;
4
8
  };
@@ -7,13 +11,9 @@ export interface insideActionsType<S> {
7
11
  setState: StoreApi<S>['setState'];
8
12
  subscribe: StoreApi<S>['subscribe'];
9
13
  }
10
- export type actionsType<S, OptionAction, InsideActions = unknown> = (getState: () => S, actions: Omit<insideActionsType<S>, 'subscribe'> & InsideActions, store: StoreApi<S>) => OptionAction;
11
- export type defGetterStateType<S> = Record<string, (state: S) => any>;
12
- export type ExtraGetterState<S, G extends defGetterStateType<S>> = {
13
- [key in keyof G]: ReturnType<G[key]>;
14
- };
15
- export interface optionsType<S, G, OptionAction> {
14
+ export type actionsType<S, G extends defGetterStateType<S>, OptionAction, InsideActions = unknown> = (getState: () => S & ExtraGetterState<S, G>, actions: Omit<insideActionsType<S>, 'subscribe'> & InsideActions, store: StoreApi<S>) => OptionAction;
15
+ export interface optionsType<S, G extends defGetterStateType<S>, OptionAction> {
16
16
  state: () => S;
17
17
  getter: G;
18
- actions: actionsType<S, OptionAction>;
18
+ actions: actionsType<S, G, OptionAction>;
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "define-zustand",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",