Skip to content

Commit

Permalink
fix: allow additional two generics
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jun 27, 2023
1 parent 3f1150f commit e6a2a10
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,15 @@ export function getProxyRequestHeaders(event: H3Event) {
}

export function fetchWithEvent<
T extends (req: RequestInfo | URL, opts?: any) => any = typeof fetch
T = unknown,
_R = any,
F extends (req: RequestInfo | URL, opts?: any) => any = typeof fetch
>(
event: H3Event,
req: RequestInfo | URL,
init?: RequestInit & { context?: H3EventContext },
options?: { fetch: T }
): ReturnType<T> {
options?: { fetch: F }
): unknown extends T ? ReturnType<F> : T {
return _getFetch(options?.fetch)(req, <RequestInit>{
...init,
context: init?.context || event.context,
Expand Down

0 comments on commit e6a2a10

Please sign in to comment.