Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TheEdoRan/next-safe-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.9.8
Choose a base ref
...
head repository: TheEdoRan/next-safe-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.9.9
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Oct 28, 2024

  1. refactor(types): less strict callbacks return type (#289)

    LavransBjerkestrand authored Oct 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    dc120df View commit details
Showing with 8 additions and 8 deletions.
  1. +1 −1 packages/next-safe-action/src/action-builder.ts
  2. +4 −4 packages/next-safe-action/src/hooks.types.ts
  3. +3 −3 packages/next-safe-action/src/index.types.ts
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/action-builder.ts
Original file line number Diff line number Diff line change
@@ -289,7 +289,7 @@ export function actionBuilder<
// Execute middleware chain + action function.
await executeMiddlewareStack();

const callbacksToExecute: MaybePromise<void>[] = [];
const callbacksToExecute: MaybePromise<unknown>[] = [];

// If an internal framework error occurred, throw it, so it will be processed by Next.js.
if (frameworkError) {
8 changes: 4 additions & 4 deletions packages/next-safe-action/src/hooks.types.ts
Original file line number Diff line number Diff line change
@@ -27,16 +27,16 @@ export type HookCallbacks<
CBAVE,
Data,
> = {
onExecute?: (args: { input: S extends Schema ? InferIn<S> : undefined }) => MaybePromise<void>;
onSuccess?: (args: { data?: Data; input: S extends Schema ? InferIn<S> : undefined }) => MaybePromise<void>;
onExecute?: (args: { input: S extends Schema ? InferIn<S> : undefined }) => MaybePromise<unknown>;
onSuccess?: (args: { data?: Data; input: S extends Schema ? InferIn<S> : undefined }) => MaybePromise<unknown>;
onError?: (args: {
error: Prettify<Omit<SafeActionResult<ServerError, S, BAS, CVE, CBAVE, Data>, "data">>;
input: S extends Schema ? InferIn<S> : undefined;
}) => MaybePromise<void>;
}) => MaybePromise<unknown>;
onSettled?: (args: {
result: Prettify<SafeActionResult<ServerError, S, BAS, CVE, CBAVE, Data>>;
input: S extends Schema ? InferIn<S> : undefined;
}) => MaybePromise<void>;
}) => MaybePromise<unknown>;
};

/**
6 changes: 3 additions & 3 deletions packages/next-safe-action/src/index.types.ts
Original file line number Diff line number Diff line change
@@ -175,14 +175,14 @@ export type SafeActionUtils<
bindArgsParsedInputs: InferArray<BAS>;
hasRedirected: boolean;
hasNotFound: boolean;
}) => MaybePromise<void>;
}) => MaybePromise<unknown>;
onError?: (args: {
error: Prettify<Omit<SafeActionResult<ServerError, S, BAS, CVE, CBAVE, Data>, "data">>;
metadata: MD;
ctx?: Prettify<Ctx>;
clientInput: S extends Schema ? InferIn<S> : undefined;
bindArgsClientInputs: InferInArray<BAS>;
}) => MaybePromise<void>;
}) => MaybePromise<unknown>;
onSettled?: (args: {
result: Prettify<SafeActionResult<ServerError, S, BAS, CVE, CBAVE, Data>>;
metadata: MD;
@@ -191,7 +191,7 @@ export type SafeActionUtils<
bindArgsClientInputs: InferInArray<BAS>;
hasRedirected: boolean;
hasNotFound: boolean;
}) => MaybePromise<void>;
}) => MaybePromise<unknown>;
};

/**