Skip to content

Commit f9c16f2

Browse files
fix(typings): fix the type of the socket#id attribute
Related: socketio/socket.io#4884
1 parent b3f0cab commit f9c16f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/socket.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class Socket<
151151
public readonly io: Manager<ListenEvents, EmitEvents>;
152152

153153
/**
154-
* A unique identifier for the session.
154+
* A unique identifier for the session. `undefined` when the socket is not connected.
155155
*
156156
* @example
157157
* const socket = io();
@@ -162,7 +162,7 @@ export class Socket<
162162
* console.log(socket.id); // "G5p5..."
163163
* });
164164
*/
165-
public id: string;
165+
public id: string | undefined;
166166

167167
/**
168168
* The session ID used for connection state recovery, which must not be shared (unlike {@link id}).

0 commit comments

Comments
 (0)