@infra-blocks/retry 0.4.1 → 0.5.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.d.ts +4 -4
- package/lib/esm/index.d.ts +4 -4
- package/package.json +1 -1
package/lib/cjs/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig<unknown>>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Configuration for the retry function.
|
|
16
16
|
*/
|
|
17
|
-
export interface RetryConfig<E =
|
|
17
|
+
export interface RetryConfig<E = unknown> {
|
|
18
18
|
/**
|
|
19
19
|
* The amount of retries that will be attempted. Note that the first attempt
|
|
20
20
|
* doest not count as a retry. In total, the amount of retries plus one
|
|
@@ -51,7 +51,7 @@ export interface RetryConfig<E = Error> {
|
|
|
51
51
|
/**
|
|
52
52
|
* Events and their handler types for the {@link Retry}.
|
|
53
53
|
*/
|
|
54
|
-
export type RetryEvents<E =
|
|
54
|
+
export type RetryEvents<E = unknown> = {
|
|
55
55
|
/**
|
|
56
56
|
* This event is emitted at the beginning of every attempt.
|
|
57
57
|
*
|
|
@@ -85,7 +85,7 @@ export type RetryEvents<E = Error> = {
|
|
|
85
85
|
* This type is both a promise and an event emitter, where the events are described as in
|
|
86
86
|
* {@link RetryEvents}.
|
|
87
87
|
*/
|
|
88
|
-
export interface Retry<T, E =
|
|
88
|
+
export interface Retry<T, E = unknown> extends EmitterLike<RetryEvents<E>>, PromiseLike<T> {
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* The type of the inner function that is wrapped by the {@link retry} function.
|
|
@@ -99,4 +99,4 @@ export type RetryFunction<R> = () => Promise<R>;
|
|
|
99
99
|
*
|
|
100
100
|
* @returns A {@link Retry} that is configured with the provided arguments.
|
|
101
101
|
*/
|
|
102
|
-
export declare function retry<T, E =
|
|
102
|
+
export declare function retry<T, E = unknown>(fn: RetryFunction<T>, options?: RetryConfig<E>): Retry<T, E>;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig<unknown>>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Configuration for the retry function.
|
|
16
16
|
*/
|
|
17
|
-
export interface RetryConfig<E =
|
|
17
|
+
export interface RetryConfig<E = unknown> {
|
|
18
18
|
/**
|
|
19
19
|
* The amount of retries that will be attempted. Note that the first attempt
|
|
20
20
|
* doest not count as a retry. In total, the amount of retries plus one
|
|
@@ -51,7 +51,7 @@ export interface RetryConfig<E = Error> {
|
|
|
51
51
|
/**
|
|
52
52
|
* Events and their handler types for the {@link Retry}.
|
|
53
53
|
*/
|
|
54
|
-
export type RetryEvents<E =
|
|
54
|
+
export type RetryEvents<E = unknown> = {
|
|
55
55
|
/**
|
|
56
56
|
* This event is emitted at the beginning of every attempt.
|
|
57
57
|
*
|
|
@@ -85,7 +85,7 @@ export type RetryEvents<E = Error> = {
|
|
|
85
85
|
* This type is both a promise and an event emitter, where the events are described as in
|
|
86
86
|
* {@link RetryEvents}.
|
|
87
87
|
*/
|
|
88
|
-
export interface Retry<T, E =
|
|
88
|
+
export interface Retry<T, E = unknown> extends EmitterLike<RetryEvents<E>>, PromiseLike<T> {
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* The type of the inner function that is wrapped by the {@link retry} function.
|
|
@@ -99,4 +99,4 @@ export type RetryFunction<R> = () => Promise<R>;
|
|
|
99
99
|
*
|
|
100
100
|
* @returns A {@link Retry} that is configured with the provided arguments.
|
|
101
101
|
*/
|
|
102
|
-
export declare function retry<T, E =
|
|
102
|
+
export declare function retry<T, E = unknown>(fn: RetryFunction<T>, options?: RetryConfig<E>): Retry<T, E>;
|