@tramvai/types-actions-state-context 2.36.0 → 2.37.0

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/lib/state.d.ts +7 -2
  2. package/package.json +2 -2
package/lib/state.d.ts CHANGED
@@ -42,6 +42,10 @@ export interface GetState {
42
42
  (): Record<string, any>;
43
43
  <S>(reducer: Reducer<S>): S;
44
44
  }
45
+ export interface SubscribeHandler {
46
+ (handler: (state: Record<string, any>) => void): () => void;
47
+ <S>(reducer: Reducer<S>, callback: (state: S) => void): () => void;
48
+ }
45
49
  export declare type Dispatch = <Payload>(event: Event<Payload>) => Payload;
46
50
  export interface ConsumerContext {
47
51
  executeAction<Params extends any[], Result, Deps>(action: TramvaiAction<Params, Result, Deps>, ...params: Params): Result extends Promise<any> ? Result : Promise<Result>;
@@ -79,8 +83,9 @@ export declare type DispatcherContext<TContext> = {
79
83
  store: T | string;
80
84
  optional: true;
81
85
  }): InstanceType<T> | null;
82
- subscribe(handler: () => void): () => void;
83
86
  getState: GetState;
87
+ subscribe: SubscribeHandler;
88
+ dispatch: Dispatch;
84
89
  dispatcherInterface: {
85
90
  getContext: () => TContext;
86
91
  getStore: DispatcherContext<TContext>['getStore'];
@@ -88,7 +93,7 @@ export declare type DispatcherContext<TContext> = {
88
93
  };
89
94
  export interface MiddlewareApi {
90
95
  dispatch: Dispatch;
91
- subscribe(handler: () => void): () => void;
96
+ subscribe: SubscribeHandler;
92
97
  getState: GetState;
93
98
  }
94
99
  export declare type Middleware = (api: MiddlewareApi) => (next: Dispatch) => (event: Event) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/types-actions-state-context",
3
- "version": "2.36.0",
3
+ "version": "2.37.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "tslib": "^2.4.0"
22
22
  },
23
23
  "peerDependencies": {
24
- "@tinkoff/dippy": "0.8.8"
24
+ "@tinkoff/dippy": "0.8.9"
25
25
  },
26
26
  "devDependencies": {},
27
27
  "license": "Apache-2.0",