diff --git a/.changeset/ninety-pillows-smell.md b/.changeset/ninety-pillows-smell.md new file mode 100644 index 00000000..78cfd53e --- /dev/null +++ b/.changeset/ninety-pillows-smell.md @@ -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). diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 5eb6a15d..ed1aaecf 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -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'; diff --git a/packages/core/src/retry/retry.ts b/packages/core/src/retry/retry.ts index adbdf0a3..9bc79072 100644 --- a/packages/core/src/retry/retry.ts +++ b/packages/core/src/retry/retry.ts @@ -31,7 +31,7 @@ import { } from '../remote_operation/type'; import { type RetryMeta } from './type'; -type FailInfo> = { +export type FailInfo> = { params: RemoteOperationParams; error: RemoteOperationError; meta: ExecutionMeta; @@ -51,7 +51,7 @@ type RetryConfig< RemoteOperationParams, MapParamsSource >; - otherwise?: EventCallable>; + otherwise?: EventCallable | void>; supressIntermediateErrors?: boolean; };