Skip to content

Commit

Permalink
chore: bump microbundle, typescript, fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Jul 5, 2023
1 parent deadfe3 commit 69dd940
Show file tree
Hide file tree
Showing 4 changed files with 1,721 additions and 365 deletions.
10 changes: 7 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function gretch<T = DefaultGretchResponse, A = DefaultGretchError>(
...(rest as RequestInit),
};
const controller =
typeof AbortController !== "undefined" ? new AbortController() : null;
typeof AbortController !== "undefined" ? new AbortController() : undefined;

if (controller) {
options.signal = controller.signal;
Expand All @@ -104,7 +104,9 @@ export function gretch<T = DefaultGretchResponse, A = DefaultGretchError>(
const request = new Request(normalizedURL, options);

if (hooks.before)
[].concat(hooks.before).forEach((hook) => hook(request, opts));
([] as GretchBeforeHook[])
.concat(hooks.before)
.forEach((hook) => hook(request, opts));

const fetcher = () =>
timeout
Expand Down Expand Up @@ -160,7 +162,9 @@ export function gretch<T = DefaultGretchResponse, A = DefaultGretchError>(
};

if (hooks.after)
[].concat(hooks.after).forEach((hook) => hook({ ...res }, opts));
([] as GretchAfterHook[])
.concat(hooks.after)
.forEach((hook) => hook({ ...res }, opts));

return res;
};
Expand Down
8 changes: 4 additions & 4 deletions lib/handleRetry.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { HTTPTimeout } from "./errors";

export type RetryOptions = {
attempts?: number;
codes?: number[];
methods?: string[];
delay?: number;
attempts: number;
codes: number[];
methods: string[];
delay: number;
};

export const defaultRetryOptions: RetryOptions = {
Expand Down

0 comments on commit 69dd940

Please sign in to comment.