Add some type information for events that are sent to the client.

This isn't really used for anything in particular except documentation
This commit is contained in:
Oliver-Akins 2020-09-30 23:48:23 -06:00
parent 1063126164
commit d204378ea5

26
src/types/client_data.d.ts vendored Normal file
View file

@ -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[]
}