Skip to content

Commit 2e0923f

Browse files
authored
Merge pull request #39 from sapphi-red/fix/use-any-for-dispatcher-when-lib-dom-is-used
fix: use `any` for `dispatcher` when `lib: 'dom'` is used
2 parents d711bdd + 24d45b4 commit 2e0923f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/http-proxy/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ export interface ServerOptions {
101101
fetch?: boolean | FetchOptions;
102102
}
103103

104-
export type Dispatcher = RequestInit["dispatcher"];
104+
// use `any` when `lib: "dom"` is included in tsconfig.json,
105+
// as dispatcher property does not exist in RequestInit in that case
106+
export type Dispatcher = (typeof globalThis extends { onmessage: any }
107+
? any
108+
: RequestInit)["dispatcher"];
105109

106110
export interface FetchOptions {
107111
/** Allow custom dispatcher */

0 commit comments

Comments
 (0)