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: '' }) + ) } 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 }