react-app-store-manager 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/Store.d.ts CHANGED
@@ -2,14 +2,9 @@ import React, { Context } from "react";
2
2
  interface ListenerInterface {
3
3
  onUpdate(): void;
4
4
  }
5
- export interface ActionsInterface {
6
- [action: string]: (payload: any) => any;
7
- }
8
5
  export interface StoreInterface<Value, Action> {
9
6
  context: Context<Value>;
10
7
  value: Value;
11
- actions: ActionsInterface;
12
- listeners: ListenerInterface[];
13
8
  update(store: (store: Value) => Value): void;
14
9
  action(actions: (action: Action) => any): void;
15
10
  subscribe(listener: ListenerInterface): void;
@@ -18,9 +13,9 @@ export interface StoreInterface<Value, Action> {
18
13
  export declare class Store<Value, Action> implements StoreInterface<Value, Action> {
19
14
  context: React.Context<Value>;
20
15
  value: Value;
21
- actions: any;
22
- listeners: ListenerInterface[];
23
- constructor(value: Value, actions: any);
16
+ private readonly actions?;
17
+ private listeners;
18
+ constructor(value: Value, actions?: Action);
24
19
  update(callback: any): void;
25
20
  action(callback: any): void;
26
21
  subscribe(listener: ListenerInterface): void;
@@ -1,2 +1,2 @@
1
1
  import { StoreInterface } from "./Store";
2
- export declare function createStore<Value, Actions>(value: Value, actions?: Actions): StoreInterface<Value, Actions>;
2
+ export declare function createStore<Value>(value: any, actions?: any): StoreInterface<Value, typeof actions>;
@@ -3,6 +3,6 @@ exports.__esModule = true;
3
3
  exports.createStore = void 0;
4
4
  var Store_1 = require("./Store");
5
5
  function createStore(value, actions) {
6
- return new Store_1.Store(value, actions !== null && actions !== void 0 ? actions : {});
6
+ return new Store_1.Store(value, actions);
7
7
  }
8
8
  exports.createStore = createStore;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-app-store-manager",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "tsc --declaration"