fix bun-types

This commit is contained in:
Alistair Smith
2025-05-09 14:06:19 -07:00
parent 74e369ec85
commit dfa4dee851
3 changed files with 6 additions and 15 deletions

View File

@@ -352,14 +352,10 @@ const ServerHandlers: SocketHandler = {
const options = self[bunSocketServerOptions];
const { pauseOnConnect, connectionListener, [kSocketClass]: SClass, requestCert, rejectUnauthorized } = options;
const _socket = new SClass(
SClass === require("node:tls").TLSSocket
? {
minVersion: self.minVersion,
maxVersion: self.maxVersion,
}
: {},
);
const _socket = new SClass({
minVersion: self.minVersion,
maxVersion: self.maxVersion,
});
_socket.isServer = true;
_socket.server = self;

View File

@@ -383,7 +383,6 @@ var InternalSecureContext = class SecureContext {
throw $ERR_TLS_INVALID_PROTOCOL_VERSION(minVersionName, "minimum");
}
}
console.log("minVersionName", minVersionName, new Error().stack);
this.minVersion = TLS_VERSION_MAP[minVersionName];
if (maxVersionName) {

View File

@@ -33,9 +33,7 @@ declare global {
}
}
expectType(Bun.env.BAZ).is<"BAZ">();
expectType(process.env.BAZ).is<"BAZ">();
expectType(import.meta.env.BAZ).is<"BAZ">();
expectType(node_env.BAZ).is<"BAZ">();
expectType(bun_env.BAZ).is<"BAZ">();
expectType(Bun.env.OTHER).is<string | undefined>();
@@ -44,16 +42,14 @@ expectType(import.meta.env.OTHER).is<string | undefined>();
expectType(node_env.OTHER).is<string | undefined>();
expectType(bun_env.OTHER).is<string | undefined>();
function isAllSame<T>(a: T, b: T, c: T, d: T, e: T) {
return a === b && b === c && c === d && d === e;
}
declare function isAllSame<T>(...args: T[]): void;
//prettier-ignore
{
isAllSame <"FOO"> (process.env.FOO, Bun.env.FOO, import.meta.env.FOO, node_env.FOO, bun_env.FOO);
isAllSame <"BAR"> (process.env.BAR, Bun.env.BAR, import.meta.env.BAR, node_env.BAR, bun_env.BAR);
isAllSame <"BAZ"> (process.env.BAZ, Bun.env.BAZ, import.meta.env.BAZ, node_env.BAZ, bun_env.BAZ);
isAllSame <"BAZ"> ( Bun.env.BAZ, import.meta.env.BAZ, bun_env.BAZ); // process.env doesn't extend import.meta.env
isAllSame <string | undefined> (process.env.OTHER, Bun.env.OTHER, import.meta.env.OTHER, node_env.OTHER, bun_env.OTHER);
}