From d204378ea5bdf8dc507e4f80eebbcab315067e6d Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 30 Sep 2020 23:48:23 -0600 Subject: [PATCH] Add some type information for events that are sent to the client. This isn't really used for anything in particular except documentation --- src/types/client_data.d.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/types/client_data.d.ts diff --git a/src/types/client_data.d.ts b/src/types/client_data.d.ts new file mode 100644 index 0000000..49d6f5a --- /dev/null +++ b/src/types/client_data.d.ts @@ -0,0 +1,26 @@ +interface response { + success: boolean; + message?: string; +} + +interface HostInformation extends response { + // properties depend on `success` being `true` + game_code?: string; + players?: string[]; +} + +// Event is only emitted when the JoinGame event is successful, so there is no +// success indicator in this response +interface NewPlayer { + player: string; +} + +interface GameJoined extends response { + // properties depend on `success` being `true` + players: string[]; +} + +interface PlayerListResponse extends response { + // properties depend on `success` being `true` + players: string[] +} \ No newline at end of file