From 1063126164df4afc92dae5830ee4705b2a43b3af Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 30 Sep 2020 23:10:35 -0600 Subject: [PATCH] Add interfaces for each event's data --- src/events/ChancellorNomination.ts | 2 +- src/events/ChancellorPolicy.ts | 2 +- src/events/PresidentPolicies.ts | 2 +- src/events/StartGame.ts | 2 +- src/events/VetoConfirm.ts | 2 +- src/events/VetoRequest.ts | 2 +- src/events/Vote.ts | 2 +- src/events/special/Execution/ExecutePlayer.ts | 2 +- src/events/special/ExecutiveConfirmation.ts | 2 +- .../InvestigateAffiliation.ts | 2 +- .../special/SpecialElection/NextPresident.ts | 2 +- src/types/data.d.ts | 28 +++++++++++++++++-- 12 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/events/ChancellorNomination.ts b/src/events/ChancellorNomination.ts index 2ee4996..3f1f30e 100644 --- a/src/events/ChancellorNomination.ts +++ b/src/events/ChancellorNomination.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const ChancellorNomination = (socket: Socket, data: any) => { +export const ChancellorNomination = (socket: Socket, data: ChancellorNomination) => { console.log(`ChancellorNomination event`); }; \ No newline at end of file diff --git a/src/events/ChancellorPolicy.ts b/src/events/ChancellorPolicy.ts index 2c7150b..9cc2b6e 100644 --- a/src/events/ChancellorPolicy.ts +++ b/src/events/ChancellorPolicy.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const ChancellorPolicy = (socket: Socket, data: any) => { +export const ChancellorPolicy = (socket: Socket, data: ChancellorPolicy) => { console.log(`Chancellor policy`); }; \ No newline at end of file diff --git a/src/events/PresidentPolicies.ts b/src/events/PresidentPolicies.ts index f0240e7..0a72350 100644 --- a/src/events/PresidentPolicies.ts +++ b/src/events/PresidentPolicies.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const PresidentPolicies = (socket: Socket, data: any) => { +export const PresidentPolicies = (socket: Socket, data: PresidentPolicies) => { console.log(`Received Presidential policies`); }; \ No newline at end of file diff --git a/src/events/StartGame.ts b/src/events/StartGame.ts index e03eca9..bd93fb9 100644 --- a/src/events/StartGame.ts +++ b/src/events/StartGame.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const StartGame = (socket: Socket, data: any) => { +export const StartGame = (socket: Socket, data: StartGame) => { console.log(`Game starting`); }; \ No newline at end of file diff --git a/src/events/VetoConfirm.ts b/src/events/VetoConfirm.ts index b012b79..983d20b 100644 --- a/src/events/VetoConfirm.ts +++ b/src/events/VetoConfirm.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const VetoConfirm = (socket: Socket, data: any) => { +export const VetoConfirm = (socket: Socket, data: VetoConfirm) => { console.log(`President's veto confirmation`); }; \ No newline at end of file diff --git a/src/events/VetoRequest.ts b/src/events/VetoRequest.ts index 58ccb7f..7318a12 100644 --- a/src/events/VetoRequest.ts +++ b/src/events/VetoRequest.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const VetoRequest = (socket: Socket, data: any) => { +export const VetoRequest = (socket: Socket, data: VetoRequest) => { console.log(`Chancellor requesting veto`); }; \ No newline at end of file diff --git a/src/events/Vote.ts b/src/events/Vote.ts index b7f61fb..0a6c53b 100644 --- a/src/events/Vote.ts +++ b/src/events/Vote.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const Vote = (socket: Socket, data: any) => { +export const Vote = (socket: Socket, data: Vote) => { console.log(`Vote received`); }; \ No newline at end of file diff --git a/src/events/special/Execution/ExecutePlayer.ts b/src/events/special/Execution/ExecutePlayer.ts index 7670c27..a6acfad 100644 --- a/src/events/special/Execution/ExecutePlayer.ts +++ b/src/events/special/Execution/ExecutePlayer.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const ExecutePlayer = (socket: Socket, data: any) => { +export const ExecutePlayer = (socket: Socket, data: ExecutePlayer) => { console.log(`Killing a player`); }; \ No newline at end of file diff --git a/src/events/special/ExecutiveConfirmation.ts b/src/events/special/ExecutiveConfirmation.ts index 395eec2..a854148 100644 --- a/src/events/special/ExecutiveConfirmation.ts +++ b/src/events/special/ExecutiveConfirmation.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const ExecutiveConfirmation = (socket: Socket, data: any) => { +export const ExecutiveConfirmation = (socket: Socket, data: ExecutiveConfirmation) => { console.log(`Just a plain ole confirmation`); }; \ No newline at end of file diff --git a/src/events/special/InvestigateLoyalty/InvestigateAffiliation.ts b/src/events/special/InvestigateLoyalty/InvestigateAffiliation.ts index a6c8900..5d91ce2 100644 --- a/src/events/special/InvestigateLoyalty/InvestigateAffiliation.ts +++ b/src/events/special/InvestigateLoyalty/InvestigateAffiliation.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const InvestigateAffiliation = (socket: Socket, data: any) => { +export const InvestigateAffiliation = (socket: Socket, data: InvestigateAffiliation) => { console.log(`Investigating a player`); }; \ No newline at end of file diff --git a/src/events/special/SpecialElection/NextPresident.ts b/src/events/special/SpecialElection/NextPresident.ts index 337485b..55c6962 100644 --- a/src/events/special/SpecialElection/NextPresident.ts +++ b/src/events/special/SpecialElection/NextPresident.ts @@ -1,4 +1,4 @@ import { Socket } from 'socket.io'; -export const NextPresident = (socket: Socket, data: any) => { +export const NextPresident = (socket: Socket, data: NextPresident) => { console.log(`Choosing the Next President`); }; \ No newline at end of file diff --git a/src/types/data.d.ts b/src/types/data.d.ts index 091f9a5..c675ca2 100644 --- a/src/types/data.d.ts +++ b/src/types/data.d.ts @@ -1,3 +1,19 @@ +interface ExecutePlayer {} + +interface InvestigateAffiliation {} + +interface NextPresident {} + +interface ExecutiveConfirmation {} + +interface ChancellorNomination {} + +interface ChancellorPolicy {} + +interface GetPlayerList { + game_code: string; +} + interface HostGame { username: string; } @@ -7,6 +23,12 @@ interface JoinGame { username: string; } -interface GetPlayerList { - game_code: string; -} \ No newline at end of file +interface PresidentPolicies {} + +interface StartGame {} + +interface VetoConfirm {} + +interface VetoRequest {} + +interface Vote {} \ No newline at end of file