File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,14 @@ export function initProxyFromEnv(): void {
99 const direct = new Agent ( )
1010 const proxies = new Map < string , ProxyAgent > ( )
1111
12- const dispatcher : Dispatcher = {
12+ // We only need a minimal dispatcher that implements `dispatch` at runtime.
13+ // Typing the object as `Dispatcher` forces TypeScript to require many
14+ // additional methods. Instead, keep a plain object and cast when passing
15+ // to `setGlobalDispatcher`.
16+ const dispatcher = {
1317 dispatch (
14- options : Dispatcher . RequestOptions ,
15- handler : Dispatcher . DispatchHandlers ,
18+ options : Dispatcher . DispatchOptions ,
19+ handler : Dispatcher . DispatchHandler ,
1620 ) {
1721 try {
1822 const origin =
@@ -54,7 +58,7 @@ export function initProxyFromEnv(): void {
5458 } ,
5559 }
5660
57- setGlobalDispatcher ( dispatcher )
61+ setGlobalDispatcher ( dispatcher as unknown as Dispatcher )
5862 consola . debug ( "HTTP proxy configured from environment (per-URL)" )
5963 } catch ( err ) {
6064 consola . debug ( "Proxy setup skipped:" , err )
You can’t perform that action at this time.
0 commit comments