chem-rx 0.0.11 → 0.0.12

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/dist/useAtom.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { ReadOnlyAtom } from "./Atom";
2
- export declare function useAtom<T>(atom: ReadOnlyAtom<T>): T;
1
+ import { BaseAtom, NullableBaseAtom } from "./Atom";
2
+ export declare function useAtom<T>(atom: BaseAtom<T> | NullableBaseAtom<T>): T;
3
3
  //# sourceMappingURL=useAtom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAtom.d.ts","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAcnD"}
1
+ {"version":3,"file":"useAtom.d.ts","sourceRoot":"","sources":["../src/useAtom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAEpD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAcrE"}
@@ -1,5 +1,5 @@
1
- import { BaseAtom } from "./Atom";
1
+ import { BaseAtom, NullableBaseAtom } from "./Atom";
2
2
  export declare function useSelectAtom<T extends {
3
3
  [key in K]: V;
4
- }, K extends keyof T, V = T[K]>(atom: BaseAtom<T>, key: K): T[K];
4
+ }, K extends keyof T, V = T[K]>(atom: NullableBaseAtom<T> | BaseAtom<T>, key: K): T[K];
5
5
  //# sourceMappingURL=useSelectAtom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSelectAtom.d.ts","sourceRoot":"","sources":["../src/useSelectAtom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,wBAAgB,aAAa,CAC3B,CAAC,SAAS;KACP,GAAG,IAAI,CAAC,GAAG,CAAC;CACd,EACD,CAAC,SAAS,MAAM,CAAC,EACjB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACR,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAcjC"}
1
+ {"version":3,"file":"useSelectAtom.d.ts","sourceRoot":"","sources":["../src/useSelectAtom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAEpD,wBAAgB,aAAa,CAC3B,CAAC,SAAS;KACP,GAAG,IAAI,CAAC,GAAG,CAAC;CACd,EACD,CAAC,SAAS,MAAM,CAAC,EACjB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACR,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAcvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chem-rx",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "react state primitives powered by rx.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/useAtom.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
- import { ReadOnlyAtom } from "./Atom";
2
+ import { BaseAtom, NullableBaseAtom } from "./Atom";
3
3
 
4
- export function useAtom<T>(atom: ReadOnlyAtom<T>): T {
4
+ export function useAtom<T>(atom: BaseAtom<T> | NullableBaseAtom<T>): T {
5
5
  const [value, setValue] = useState<T>(atom.value());
6
6
 
7
7
  useEffect(() => {
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from "react";
2
- import { BaseAtom } from "./Atom";
2
+ import { BaseAtom, NullableBaseAtom } from "./Atom";
3
3
 
4
4
  export function useSelectAtom<
5
5
  T extends {
@@ -7,7 +7,7 @@ export function useSelectAtom<
7
7
  },
8
8
  K extends keyof T,
9
9
  V = T[K]
10
- >(atom: BaseAtom<T>, key: K): T[K] {
10
+ >(atom: NullableBaseAtom<T> | BaseAtom<T>, key: K): T[K] {
11
11
  const [value, setValue] = useState<T[K]>(atom.get(key)!);
12
12
 
13
13
  useEffect(() => {