Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ninety-pillows-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@farfetched/core": patch
---

Support for importing the FailInfo type has been added, and the type for the otherwise field in the retry configuration object has been extended (enabling the use of an event of type EventCallable<void>).
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export { createHeadlessMutation } from './mutation/create_headless_mutation';
export { createJsonMutation } from './mutation/create_json_mutation';

// Retry public API
export { type FailInfo } from './retry/retry';
export { retry } from './retry/retry';
export { exponentialDelay, linearDelay } from './retry/delay';

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/retry/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
} from '../remote_operation/type';
import { type RetryMeta } from './type';

type FailInfo<Q extends RemoteOperation<any, any, any, any>> = {
export type FailInfo<Q extends RemoteOperation<any, any, any, any>> = {
params: RemoteOperationParams<Q>;
error: RemoteOperationError<Q>;
meta: ExecutionMeta;
Expand All @@ -51,7 +51,7 @@ type RetryConfig<
RemoteOperationParams<Q>,
MapParamsSource
>;
otherwise?: EventCallable<FailInfo<Q>>;
otherwise?: EventCallable<FailInfo<Q> | void>;
supressIntermediateErrors?: boolean;
};

Expand Down