@webkrafters/react-observable-context 0.0.1 → 0.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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ The `useStore` returns the context `store` object for consuming the React-Observ
18
18
 
19
19
  The context `store` exposes **4** methods for interacting with the context namely:
20
20
 
21
- * **getState**: (selector?: (state: State) => PartialState\<State\>) => PartialState\<State\>
21
+ * **getState**: (selector?: (state: State) => any) => any
22
22
 
23
23
  * **resetState**: VoidFunction // resets the state to the Provider latest `value` prop.
24
24
 
package/dist/index.d.ts CHANGED
@@ -15,9 +15,9 @@ export type State = {
15
15
  export type PartialState<T_1 extends State> = {
16
16
  [x: string]: any;
17
17
  } & { [K in keyof T]?: T[K]; };
18
- export type Selector<T_1 extends State> = (state: T) => PartialState<T>;
18
+ export type Selector<T_1 extends State> = (state: T) => any;
19
19
  export type Store<T_1 extends State> = {
20
- getState: (selector?: Selector<T>) => PartialState<T>;
20
+ getState: (selector?: Selector<T>) => any;
21
21
  resetState: OptionalTask<VoidFunction>;
22
22
  setState: (changes: PartialState<T>) => void;
23
23
  subscribe: (listener: Listener<T>) => Unsubscribe;
package/dist/index.js CHANGED
@@ -157,26 +157,30 @@ Provider.displayName = 'ObservableContext.Provider';
157
157
  */
158
158
 
159
159
  /**
160
- @typedef {(newValue: PartialState<T>, oldValue: PartialState<T>) => void} Listener
161
- @template {State} T
160
+ * @typedef {(newValue: PartialState<T>, oldValue: PartialState<T>) => void} Listener
161
+ * @template {State} T
162
162
  */
163
+
163
164
  /** @typedef {{[x:string]: *}} State */
165
+
164
166
  /**
165
- @typedef {{[x:string]: *} & {[K in keyof T]?: T[K]}} PartialState
166
- @template {State} T
167
+ * @typedef {{[x:string]: *} & {[K in keyof T]?: T[K]}} PartialState
168
+ * @template {State} T
167
169
  */
170
+
168
171
  /**
169
- @typedef {(state: T) => PartialState<T>} Selector
170
- @template {State} T
172
+ * @typedef {(state: T) => *} Selector
173
+ * @template {State} T
171
174
  */
175
+
172
176
  /**
173
177
  * @typedef {{
174
- * getState: OptionalTask<(selector?: Selector<T>) => PartialState<T>>,
178
+ * getState: OptionalTask<(selector?: Selector<T>) => *>,
175
179
  * resetState: OptionalTask<VoidFunction>,
176
180
  * setState: OptionalTask<(changes: PartialState<T>) => void>,
177
181
  * subscribe: OptionalTask<(listener: Listener<T>) => Unsubscribe>
178
182
  * }} Store
179
- @template {State} T
183
+ * @template {State} T
180
184
  */
181
185
 
182
186
  /** @typedef {VoidFunction} Unsubscribe */
package/package.json CHANGED
@@ -74,5 +74,5 @@
74
74
  "test:watch": "eslint --fix && jest --watchAll"
75
75
  },
76
76
  "types": "dist/index.d.ts",
77
- "version": "0.0.1"
77
+ "version": "0.0.2"
78
78
  }