diff --git a/lib/socket.ts b/lib/socket.ts index 8a992e10..532a7423 100644 --- a/lib/socket.ts +++ b/lib/socket.ts @@ -151,7 +151,7 @@ export class Socket< public readonly io: Manager; /** - * A unique identifier for the session. + * A unique identifier for the session. `undefined` when the socket is not connected. * * @example * const socket = io(); @@ -162,7 +162,7 @@ export class Socket< * console.log(socket.id); // "G5p5..." * }); */ - public id: string; + public id: string | undefined; /** * The session ID used for connection state recovery, which must not be shared (unlike {@link id}).