watch-state 3.6.0 → 3.6.1

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/State/State.d.ts +7 -7
  2. package/package.json +1 -1
package/State/State.d.ts CHANGED
@@ -17,9 +17,9 @@ import { Observable } from '../Observable';
17
17
  * // Update value
18
18
  * count.value++ // logs: 1
19
19
  */
20
- export declare class State<V = never | unknown> extends Observable<V extends never ? unknown : V> {
20
+ export declare class State<T = unknown> extends Observable<T> {
21
21
  /** Current value. No auto-subscription on direct access (unlike `value`). */
22
- raw: V extends never ? unknown : V;
22
+ raw: T;
23
23
  /**
24
24
  * Initial state value set during construction.
25
25
  * Used by `reset()` to restore state to its original value.
@@ -30,8 +30,8 @@ export declare class State<V = never | unknown> extends Observable<V extends nev
30
30
  *
31
31
  * const isChanged = count.initial === count.raw
32
32
  */
33
- readonly initial: V extends never ? unknown : V;
34
- constructor(...args: V extends never | undefined ? [V?] : [V]);
33
+ readonly initial: T;
34
+ constructor(...args: T extends undefined ? [T?] : [T]);
35
35
  /**
36
36
  * Current state value. Updates watchers only on actual changes (strict `!==`).
37
37
  * Using `value` inside a `Watch` callback automatically subscribes to changes.
@@ -43,15 +43,15 @@ export declare class State<V = never | unknown> extends Observable<V extends nev
43
43
  * count.value = 1 // triggers watchers
44
44
  * count.value = 1 // no trigger
45
45
  */
46
- get value(): V extends never ? unknown : V;
47
- set value(value: V extends never ? unknown : V);
46
+ get value(): T;
47
+ set value(value: T);
48
48
  /**
49
49
  * Sets the state value. Identical to the `value` setter but returns `void`.
50
50
  * Useful as a shorthand in arrow functions: `() => state.set(value)` instead of `() => { state.value = value }`
51
51
  *
52
52
  * `state.set` cannot be used as a standalone function: `const set = state.set`
53
53
  */
54
- set(value: V extends never ? unknown : V): void;
54
+ set(value: T): void;
55
55
  /**
56
56
  * Resets state to its initial value.
57
57
  * Triggers watchers only if the current value differs from the initial value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watch-state",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "CANT inc. state management system.",
5
5
  "author": "Mikhail Lysikov <d8corp@mail.ru>",
6
6
  "license": "MIT",