diff --git a/src/telegram/proxy.ts b/src/telegram/proxy.ts index f88b9d392..1f9c6f2bc 100644 --- a/src/telegram/proxy.ts +++ b/src/telegram/proxy.ts @@ -5,10 +5,10 @@ export function makeProxyFetch(proxyUrl: string): typeof fetch { const agent = new ProxyAgent(proxyUrl); // undici's fetch is runtime-compatible with global fetch but the types diverge // on stream/body internals. Single cast at the boundary keeps the rest type-safe. - const fetcher = (input: RequestInfo | URL, init?: RequestInit) => + const fetcher = ((input: RequestInfo | URL, init?: RequestInit) => undiciFetch(input as string | URL, { ...(init as Record), dispatcher: agent, - }) as unknown as Promise; + }) as unknown as Promise) as typeof fetch; return wrapFetchWithAbortSignal(fetcher); }