From 9555e31a1ca6a697f3e03aa223b85c12da0be7e7 Mon Sep 17 00:00:00 2001 From: Sascha Englert Date: Fri, 17 Aug 2018 12:34:20 +0200 Subject: [PATCH 1/2] Added interfaces for Room and Rooms dictonaries --- types/socket.io/index.d.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 2b5100abb2..4396299a32 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -696,6 +696,22 @@ declare namespace SocketIO { query: any; } + /** + * The interface describing a room + */ + interface Room { + sockets: {[id: string]: boolean } + } + + /** + * The interface describing a dictionary of rooms + * Where room is the name of the room + */ + + interface Rooms { + [room: string]: Room + } + /** * The interface used when dealing with rooms etc */ @@ -708,9 +724,8 @@ declare namespace SocketIO { /** * A dictionary of all the rooms that we have in this namespace - * The rooms are made of a `sockets` key which is the dictionary of sockets per ID */ - rooms: {[room: string]: {sockets: {[id: string]: boolean }, length: number }}; + rooms: Rooms; /** * A dictionary of all the socket ids that we're dealing with, and all From 794a2adf7dc0afd46267afcb99b1fa6039ae73d0 Mon Sep 17 00:00:00 2001 From: Sascha Englert Date: Fri, 17 Aug 2018 12:49:21 +0200 Subject: [PATCH 2/2] Added missing length field --- types/socket.io/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 4396299a32..6c12e444b0 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -700,7 +700,8 @@ declare namespace SocketIO { * The interface describing a room */ interface Room { - sockets: {[id: string]: boolean } + sockets: {[id: string]: boolean }; + length: number; } /** @@ -709,7 +710,7 @@ declare namespace SocketIO { */ interface Rooms { - [room: string]: Room + [room: string]: Room; } /**