use-effect-ts 0.0.2 → 0.0.3

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
@@ -1,3 +1,3 @@
1
1
  # use-effect-ts
2
2
 
3
- Effect.TS hooks for React.
3
+ React hooks for Effect.TS 🚀
@@ -1,3 +1,3 @@
1
1
  import { Effect } from "effect";
2
- export declare function useRunEffectLatest<Args extends any[], A, E>(fn: (...args: Args) => Effect.Effect<A, E, never>): (...args: Args) => void | Promise<import("effect/Exit").Exit<import("effect/Fiber").RuntimeFiber<A, E>, never>>;
2
+ export declare function useRunEffectLatest<Args extends any[], A, E>(fn: (...args: Args) => Effect.Effect<A, E, never>): (...args: Args) => Promise<import("effect/Exit").Exit<import("effect/Fiber").RuntimeFiber<A, E>, never>>;
3
3
  //# sourceMappingURL=use-run-effect-latest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-run-effect-latest.d.ts","sourceRoot":"","sources":["../src/use-run-effect-latest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,QAAQ,CAAC;AAIpD,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EACzD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,IAYzC,GAAG,MAAM,IAAI,kGAStB"}
1
+ {"version":3,"file":"use-run-effect-latest.d.ts","sourceRoot":"","sources":["../src/use-run-effect-latest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,QAAQ,CAAC;AAIpD,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EACzD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,IAYzC,GAAG,MAAM,IAAI,2FAStB"}
@@ -9,7 +9,7 @@ export function useRunEffectLatest(fn) {
9
9
  });
10
10
  return (...args) => {
11
11
  if (!fiberHandle) {
12
- return console.error("useRunEffectLatest: No scope available, effect will not run.");
12
+ throw new Error("useRunEffectLatest: No scope available, effect will not run. Consider using useComponentLifecycle to call initial run.");
13
13
  }
14
14
  return Effect.runPromiseExit(FiberHandle.run(fiberHandle, fn(...args)));
15
15
  };
@@ -1,3 +1,3 @@
1
1
  import { Effect } from "effect";
2
- export declare function useRunEffect<Args extends any[], A, E>(fn: (...args: Args) => Effect.Effect<A, E, never>): (...args: Args) => void | Promise<import("effect/Exit").Exit<import("effect/Fiber").RuntimeFiber<A, E>, never>>;
2
+ export declare function useRunEffect<Args extends any[], A, E>(fn: (...args: Args) => Effect.Effect<A, E, never>): (...args: Args) => Promise<import("effect/Exit").Exit<import("effect/Fiber").RuntimeFiber<A, E>, never>>;
3
3
  //# sourceMappingURL=use-run-effect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-run-effect.d.ts","sourceRoot":"","sources":["../src/use-run-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,QAAQ,CAAC;AAIjD,wBAAgB,YAAY,CAAC,IAAI,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EACnD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,IAQzC,GAAG,MAAM,IAAI,kGAStB"}
1
+ {"version":3,"file":"use-run-effect.d.ts","sourceRoot":"","sources":["../src/use-run-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,QAAQ,CAAC;AAIjD,wBAAgB,YAAY,CAAC,IAAI,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EACnD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,IAQzC,GAAG,MAAM,IAAI,2FAStB"}
@@ -9,7 +9,7 @@ export function useRunEffect(fn) {
9
9
  });
10
10
  return (...args) => {
11
11
  if (!fiberSet) {
12
- return console.error("useRunEffect: No scope available, effect will not run.");
12
+ throw new Error("useRunEffect: No scope available, effect will not run. Consider using useComponentLifecycle to call initial run.");
13
13
  }
14
14
  return Effect.runPromiseExit(FiberSet.run(fiberSet, fn(...args)));
15
15
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "use-effect-ts",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
7
7
  "./*": "./dist/*"
@@ -17,8 +17,8 @@ export function useRunEffectLatest<Args extends any[], A, E>(
17
17
 
18
18
  return (...args: Args) => {
19
19
  if (!fiberHandle) {
20
- return console.error(
21
- "useRunEffectLatest: No scope available, effect will not run.",
20
+ throw new Error(
21
+ "useRunEffectLatest: No scope available, effect will not run. Consider using useComponentLifecycle to call initial run.",
22
22
  );
23
23
  }
24
24
 
@@ -13,8 +13,8 @@ export function useRunEffect<Args extends any[], A, E>(
13
13
 
14
14
  return (...args: Args) => {
15
15
  if (!fiberSet) {
16
- return console.error(
17
- "useRunEffect: No scope available, effect will not run.",
16
+ throw new Error(
17
+ "useRunEffect: No scope available, effect will not run. Consider using useComponentLifecycle to call initial run.",
18
18
  );
19
19
  }
20
20