Skip to content

Commit 96effc1

Browse files
committed
fix(types): adapt Server type to Bun 1.3.14 generic requirement
1 parent 71140da commit 96effc1

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/gateway/gateway.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class BunGateway implements Gateway {
8686
/** 0http-bun router instance for high-performance request routing */
8787
private router: IRouter
8888
/** Bun server instance when using built-in server */
89-
private server: Server | null = null
89+
private server: Server<unknown> | null = null
9090
/** Map of route patterns to their proxy instances */
9191
private proxies: Map<string, ProxyInstance> = new Map()
9292
/** Map of route patterns to their load balancer instances */
@@ -874,7 +874,7 @@ export class BunGateway implements Gateway {
874874
return this.config
875875
}
876876

877-
async listen(port?: number): Promise<Server> {
877+
async listen(port?: number): Promise<Server<unknown>> {
878878
const listenPort = port ?? this.config.server?.port ?? 3000
879879

880880
// If cluster mode is enabled and we're the master, start the cluster
@@ -884,7 +884,7 @@ export class BunGateway implements Gateway {
884884

885885
// Master process doesn't serve requests directly in cluster mode
886886
// Instead, it manages worker processes
887-
return new Promise(() => {}) as Promise<Server>
887+
return new Promise(() => {}) as Promise<Server<unknown>>
888888
}
889889

890890
// Load and validate TLS certificates if enabled

src/interfaces/gateway.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ export interface Gateway {
433433
* console.log(`Gateway running on port ${server.port}`)
434434
* ```
435435
*/
436-
listen(port?: number): Promise<Server>
436+
listen(port?: number): Promise<Server<unknown>>
437437

438438
/**
439439
* Gracefully stop the gateway server

src/security/http-redirect.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function matchesAllowedHost(
5050
* });
5151
* ```
5252
*/
53-
export function createHTTPRedirectServer(config: HTTPRedirectConfig): Server {
53+
export function createHTTPRedirectServer(config: HTTPRedirectConfig): Server<unknown> {
5454
const { port, httpsPort, hostname, allowHosts, logger } = config
5555

5656
const server = Bun.serve({
@@ -147,7 +147,7 @@ export function createHTTPRedirectServer(config: HTTPRedirectConfig): Server {
147147
* Manages the lifecycle of the HTTP redirect server
148148
*/
149149
export class HTTPRedirectManager {
150-
private server: Server | null = null
150+
private server: Server<unknown> | null = null
151151
private config: HTTPRedirectConfig
152152

153153
constructor(config: HTTPRedirectConfig) {
@@ -157,7 +157,7 @@ export class HTTPRedirectManager {
157157
/**
158158
* Starts the HTTP redirect server
159159
*/
160-
start(): Server {
160+
start(): Server<unknown> {
161161
if (this.server) {
162162
throw new Error('HTTP redirect server is already running')
163163
}
@@ -187,7 +187,7 @@ export class HTTPRedirectManager {
187187
/**
188188
* Gets the server instance
189189
*/
190-
getServer(): Server | null {
190+
getServer(): Server<unknown> | null {
191191
return this.server
192192
}
193193
}

0 commit comments

Comments
 (0)