From dc120dfd7b846c6410ef409f52cb9a78daed1788 Mon Sep 17 00:00:00 2001 From: Lavrans Bjerkestrand Date: Mon, 28 Oct 2024 11:17:58 -0400 Subject: [PATCH] refactor(types): less strict callbacks return type (#289) --- packages/next-safe-action/src/action-builder.ts | 2 +- packages/next-safe-action/src/hooks.types.ts | 8 ++++---- packages/next-safe-action/src/index.types.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/next-safe-action/src/action-builder.ts b/packages/next-safe-action/src/action-builder.ts index 1d7dc8f..a255bc2 100644 --- a/packages/next-safe-action/src/action-builder.ts +++ b/packages/next-safe-action/src/action-builder.ts @@ -289,7 +289,7 @@ export function actionBuilder< // Execute middleware chain + action function. await executeMiddlewareStack(); - const callbacksToExecute: MaybePromise[] = []; + const callbacksToExecute: MaybePromise[] = []; // If an internal framework error occurred, throw it, so it will be processed by Next.js. if (frameworkError) { diff --git a/packages/next-safe-action/src/hooks.types.ts b/packages/next-safe-action/src/hooks.types.ts index 47a6426..14f528d 100644 --- a/packages/next-safe-action/src/hooks.types.ts +++ b/packages/next-safe-action/src/hooks.types.ts @@ -27,16 +27,16 @@ export type HookCallbacks< CBAVE, Data, > = { - onExecute?: (args: { input: S extends Schema ? InferIn : undefined }) => MaybePromise; - onSuccess?: (args: { data?: Data; input: S extends Schema ? InferIn : undefined }) => MaybePromise; + onExecute?: (args: { input: S extends Schema ? InferIn : undefined }) => MaybePromise; + onSuccess?: (args: { data?: Data; input: S extends Schema ? InferIn : undefined }) => MaybePromise; onError?: (args: { error: Prettify, "data">>; input: S extends Schema ? InferIn : undefined; - }) => MaybePromise; + }) => MaybePromise; onSettled?: (args: { result: Prettify>; input: S extends Schema ? InferIn : undefined; - }) => MaybePromise; + }) => MaybePromise; }; /** diff --git a/packages/next-safe-action/src/index.types.ts b/packages/next-safe-action/src/index.types.ts index 94b85ae..3e9118f 100644 --- a/packages/next-safe-action/src/index.types.ts +++ b/packages/next-safe-action/src/index.types.ts @@ -175,14 +175,14 @@ export type SafeActionUtils< bindArgsParsedInputs: InferArray; hasRedirected: boolean; hasNotFound: boolean; - }) => MaybePromise; + }) => MaybePromise; onError?: (args: { error: Prettify, "data">>; metadata: MD; ctx?: Prettify; clientInput: S extends Schema ? InferIn : undefined; bindArgsClientInputs: InferInArray; - }) => MaybePromise; + }) => MaybePromise; onSettled?: (args: { result: Prettify>; metadata: MD; @@ -191,7 +191,7 @@ export type SafeActionUtils< bindArgsClientInputs: InferInArray; hasRedirected: boolean; hasNotFound: boolean; - }) => MaybePromise; + }) => MaybePromise; }; /**