@8ms/helpers 2.4.12 → 2.4.14

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.
@@ -1,6 +1,5 @@
1
1
  import { BaseNamespace } from "../../_class/BaseNamespace.cjs";
2
2
  import { DrizzleConfig } from "./drizzle.cjs";
3
-
4
3
  //#region src/drizzle/server/DrizzleNamespace.d.ts
5
4
  declare class DrizzleNamespace<TClient = any> extends BaseNamespace {
6
5
  client: TClient;
@@ -1,5 +1,6 @@
1
1
  import { BaseNamespace } from "../../_class/BaseNamespace.mjs";
2
2
  import { DrizzleConfig } from "./drizzle.mjs";
3
+
3
4
  //#region src/drizzle/server/DrizzleNamespace.d.ts
4
5
  declare class DrizzleNamespace<TClient = any> extends BaseNamespace {
5
6
  client: TClient;
@@ -2,7 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../_virtual/_rolldown/runtime.cjs");
3
3
  let react = require("react");
4
4
  //#region src/nextJs/client/useAsyncEffect.ts
5
- const useAsyncEffect = (effect, destroy, inputs) => {
5
+ /**
6
+ * Based on https://github.com/rauldeheer/use-async-effect/tree/master
7
+ */
8
+ function useAsyncEffect(effect, destroy, inputs) {
6
9
  const hasDestroy = typeof destroy === "function";
7
10
  (0, react.useEffect)(function() {
8
11
  let result;
@@ -18,6 +21,6 @@ const useAsyncEffect = (effect, destroy, inputs) => {
18
21
  if (hasDestroy) destroy(result);
19
22
  };
20
23
  }, hasDestroy ? inputs : destroy);
21
- };
24
+ }
22
25
  //#endregion
23
26
  exports.useAsyncEffect = useAsyncEffect;
@@ -1,4 +1,5 @@
1
1
  //#region src/nextJs/client/useAsyncEffect.d.ts
2
- declare const useAsyncEffect: <T>(effect: (isMounted: () => boolean) => T | Promise<T>, destroy?: (result?: T) => void, inputs?: any[]) => void;
2
+ declare function useAsyncEffect(effect: (isMounted: () => boolean) => unknown | Promise<unknown>, inputs?: any[]): void;
3
+ declare function useAsyncEffect<V>(effect: (isMounted: () => boolean) => V | Promise<V>, destroy?: (result?: V) => void, inputs?: any[]): void;
3
4
  //#endregion
4
5
  export { useAsyncEffect };
@@ -1,4 +1,5 @@
1
1
  //#region src/nextJs/client/useAsyncEffect.d.ts
2
- declare const useAsyncEffect: <T>(effect: (isMounted: () => boolean) => T | Promise<T>, destroy?: (result?: T) => void, inputs?: any[]) => void;
2
+ declare function useAsyncEffect(effect: (isMounted: () => boolean) => unknown | Promise<unknown>, inputs?: any[]): void;
3
+ declare function useAsyncEffect<V>(effect: (isMounted: () => boolean) => V | Promise<V>, destroy?: (result?: V) => void, inputs?: any[]): void;
3
4
  //#endregion
4
5
  export { useAsyncEffect };
@@ -1,6 +1,9 @@
1
1
  import { useEffect } from "react";
2
2
  //#region src/nextJs/client/useAsyncEffect.ts
3
- const useAsyncEffect = (effect, destroy, inputs) => {
3
+ /**
4
+ * Based on https://github.com/rauldeheer/use-async-effect/tree/master
5
+ */
6
+ function useAsyncEffect(effect, destroy, inputs) {
4
7
  const hasDestroy = typeof destroy === "function";
5
8
  useEffect(function() {
6
9
  let result;
@@ -16,6 +19,6 @@ const useAsyncEffect = (effect, destroy, inputs) => {
16
19
  if (hasDestroy) destroy(result);
17
20
  };
18
21
  }, hasDestroy ? inputs : destroy);
19
- };
22
+ }
20
23
  //#endregion
21
24
  export { useAsyncEffect };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.4.12",
4
+ "version": "2.4.14",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"