Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/http-proxy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ export interface ServerOptions {
fetch?: boolean | FetchOptions;
}

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

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional type logic has a syntax error. When accessing the dispatcher property on line 108, it's being accessed on the result of the conditional type (typeof globalThis extends { onmessage: any } ? any : RequestInit), but the parenthesis closes before ["dispatcher"] is applied.

This means you're trying to do: (ConditionalType)["dispatcher"] which attempts to access the property on the conditional type result itself. Instead, it should be:

export type Dispatcher = (typeof globalThis extends { onmessage: any }
  ? any
  : RequestInit["dispatcher"]);

Move the ["dispatcher"] access inside the false branch so it only accesses the property when RequestInit is selected.

Suggested change
: RequestInit)["dispatcher"];
: RequestInit["dispatcher"]);

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(seems like nonsense by ai)


export interface FetchOptions {
/** Allow custom dispatcher */
Expand Down
Loading