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 {
9
9
const direct = new Agent ( )
10
10
const proxies = new Map < string , ProxyAgent > ( )
11
11
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 = {
13
17
dispatch (
14
- options : Dispatcher . RequestOptions ,
15
- handler : Dispatcher . DispatchHandlers ,
18
+ options : Dispatcher . DispatchOptions ,
19
+ handler : Dispatcher . DispatchHandler ,
16
20
) {
17
21
try {
18
22
const origin =
@@ -54,7 +58,7 @@ export function initProxyFromEnv(): void {
54
58
} ,
55
59
}
56
60
57
- setGlobalDispatcher ( dispatcher )
61
+ setGlobalDispatcher ( dispatcher as unknown as Dispatcher )
58
62
consola . debug ( "HTTP proxy configured from environment (per-URL)" )
59
63
} catch ( err ) {
60
64
consola . debug ( "Proxy setup skipped:" , err )
You can’t perform that action at this time.
0 commit comments