No overload matches this call.
The last overload gave the following error.
Object literal may only specify known properties, and 'tls' does not exist in type 'RequestInit'.ts(2769)
lib.dom.d.ts(28327, 18): The last overload is declared here.
Additional information
I believe this is an issue with DefinitelyTyped's bun types being behind in version. Looks like the last version merged with 1.1.17. Or possibly with the monorepo bun-types being incorrect.
interface FetchRequestInit extends RequestInit {
/**
* Log the raw HTTP request & response to stdout. This API may be
* removed in a future version of Bun without notice.
* This is a custom property that is not part of the Fetch API specification.
* It exists mostly as a debugging tool
*/
verbose?: boolean;
/**
* Override http_proxy or HTTPS_PROXY
* This is a custom property that is not part of the Fetch API specification.
*/
proxy?: string;
/**
* Override the default TLS options
*/
tls?: {
rejectUnauthorized?: boolean | undefined; // Defaults to true
checkServerIdentity?: any; // TODO: change `any` to `checkServerIdentity`
};
}
As seen tls only has the two properties rejectUnauthorized and checkServerIdentity, and is missing key, cert, and ca .
What version of Bun is running?
1.1.22-canary.96+df33f2b2a
What platform is your computer?
Linux 6.6.6-76060606-generic x86_64 x86_64
What steps can reproduce the bug?
Create a new bun project using
bun init
Copy and paste the fetch tls example from bun docs https://bun.sh/docs/api/fetch
What is the expected behavior?
Expected behavior is to have no type errors.
What do you see instead?
Type error on tls:
Additional information
I believe this is an issue with DefinitelyTyped's bun types being behind in version. Looks like the last version merged with 1.1.17. Or possibly with the monorepo bun-types being incorrect.
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bun https://github.com/oven-sh/bun/tree/main/packages/bun-types
From the
node_modules/bun-types/globals.d.ts
As seen tls only has the two properties
rejectUnauthorized
andcheckServerIdentity
, and is missingkey
,cert
, andca
.