From f145d71abe246f1276a797308d4fc7491d8fa8e5 Mon Sep 17 00:00:00 2001 From: yusheng Date: Tue, 24 Mar 2026 09:20:41 +0800 Subject: [PATCH 1/2] fix type `ClientConnectOptions` --- types/client.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/client.d.ts b/types/client.d.ts index a6e20221f68..7521368c26b 100644 --- a/types/client.d.ts +++ b/types/client.d.ts @@ -3,7 +3,7 @@ import Dispatcher from './dispatcher' import buildConnector from './connector' import TClientStats from './client-stats' -type ClientConnectOptions = Omit +type ClientConnectOptions = Omit, 'origin'> /** * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default. @@ -20,12 +20,12 @@ export class Client extends Dispatcher { readonly stats: TClientStats // Override dispatcher APIs. - override connect ( - options: ClientConnectOptions - ): Promise - override connect ( - options: ClientConnectOptions, - callback: (err: Error | null, data: Dispatcher.ConnectData) => void + override connect ( + options: ClientConnectOptions + ): Promise> + override connect ( + options: ClientConnectOptions, + callback: (err: Error | null, data: Dispatcher.ConnectData) => void ): void } From 36b4e933d8e95994a323695ad33190b4b1c4f758 Mon Sep 17 00:00:00 2001 From: yusheng chen Date: Fri, 27 Mar 2026 22:45:04 +0800 Subject: [PATCH 2/2] add type test for client.connect --- test/types/client.test-d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/types/client.test-d.ts b/test/types/client.test-d.ts index ed50d85194d..a1e8b62af79 100644 --- a/test/types/client.test-d.ts +++ b/test/types/client.test-d.ts @@ -319,4 +319,15 @@ expectAssignable( expectType(client.stats.pending) expectType(client.stats.running) expectType(client.stats.size) + + // opaque + expectType>>( + client.connect({ opaque: 123, path: '' }) + ) + expectType>>( + client.connect({ path: '' }) + ) + expectType>>( + client.connect({ opaque: { foo: 'bar' }, path: '' }) + ) }