@@ -37,6 +37,8 @@ type ParentNspNameMatchFn = (
37
37
fn : ( err : Error | null , success : boolean ) => void
38
38
) => void ;
39
39
40
+ type AdapterConstructor = typeof Adapter | ( ( nsp : Namespace ) => Adapter ) ;
41
+
40
42
interface EngineOptions {
41
43
/**
42
44
* how many ms without a pong packet to consider the connection closed
@@ -152,7 +154,7 @@ interface ServerOptions extends EngineAttachOptions {
152
154
* the adapter to use
153
155
* @default the in-memory adapter (https://github.com/socketio/socket.io-adapter)
154
156
*/
155
- adapter : any ;
157
+ adapter : AdapterConstructor ;
156
158
/**
157
159
* the parser to use
158
160
* @default the default parser (https://github.com/socketio/socket.io-parser)
@@ -207,7 +209,7 @@ export class Server<
207
209
ParentNspNameMatchFn ,
208
210
ParentNamespace < ListenEvents , EmitEvents , ServerSideEvents >
209
211
> = new Map ( ) ;
210
- private _adapter ?: typeof Adapter ;
212
+ private _adapter ?: AdapterConstructor ;
211
213
private _serveClient : boolean ;
212
214
private opts : Partial < EngineOptions > ;
213
215
private eio ;
@@ -360,10 +362,11 @@ export class Server<
360
362
* @return self when setting or value when getting
361
363
* @public
362
364
*/
363
- public adapter ( ) : typeof Adapter | undefined ;
364
- public adapter ( v : typeof Adapter ) : this;
365
- public adapter ( v ?: typeof Adapter ) : typeof Adapter | undefined | this;
366
- public adapter ( v ?: typeof Adapter ) : typeof Adapter | undefined | this {
365
+ public adapter ( ) : AdapterConstructor | undefined ;
366
+ public adapter ( v : AdapterConstructor ) : this;
367
+ public adapter (
368
+ v ?: AdapterConstructor
369
+ ) : AdapterConstructor | undefined | this {
367
370
if ( ! arguments . length ) return this . _adapter ;
368
371
this . _adapter = v ;
369
372
for ( const nsp of this . _nsps . values ( ) ) {
0 commit comments