diff --git a/.changeset/ten-beds-exercise.md b/.changeset/ten-beds-exercise.md new file mode 100644 index 0000000..4fab83a --- /dev/null +++ b/.changeset/ten-beds-exercise.md @@ -0,0 +1,6 @@ +--- +"safe-fn": patch +"safe-fn-react": patch +--- + +Fix type issues with the hook (related to distribution) diff --git a/packages/safe-fn/src/result.ts b/packages/safe-fn/src/result.ts index e00d438..ff3319b 100644 --- a/packages/safe-fn/src/result.ts +++ b/packages/safe-fn/src/result.ts @@ -60,14 +60,23 @@ export type InferActionErrError = /** * Converts a `ResultAsync` to a ``. */ -export type ResultAsyncToActionResult = - T extends ResultAsync ? ActionResult : never; +export type ResultAsyncToActionResult = [T] extends [ + ResultAsync, +] + ? ActionResult + : never; -export type ActionResultToResultAsync = - T extends ActionResult ? ResultAsync : never; +export type ActionResultToResultAsync = [T] extends [ + ActionResult, +] + ? ResultAsync + : never; -export type ActionResultToResult = - T extends ActionResult ? Result : never; +export type ActionResultToResult = [T] extends [ + ActionResult, +] + ? Result + : never; /** * Converts an `ActionResult` to a `Result`.