Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed using option "unix" in Bun's fetch result in type error #18402

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LeiCraft
Copy link

What does this PR do?

fixes a type error when using the unix option in Bun's fetch function.

Previously this code would result in an type error because the option "unix" is not defined in the types

const response = await fetch("http://localhost/info", {
    unix: "/var/run/path/to/unix.sock"
});
error TS2769: No overload matches this call.
  Overload 1 of 2, '(input: string | URL | Request, init?: RequestInit | undefined): Promise<Response>', gave the following error.
    Object literal may only specify known properties, and 'unix' does not exist in type 'RequestInit'.
  Overload 2 of 2, '(input: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response>', gave the following error.
    Object literal may only specify known properties, and 'unix' does not exist in type 'RequestInit'.

How did you verify your code works?

I checked for type errors using the typescript compiler after i updated the type BunFetchRequestInit

@RiskyMH RiskyMH added the types An issue with TypeScript types label Mar 22, 2025
@Jarred-Sumner Jarred-Sumner requested a review from alii March 23, 2025 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types An issue with TypeScript types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants