Add interfaces for each event's data

This commit is contained in:
Oliver-Akins 2020-09-30 23:10:35 -06:00
parent cfb915724f
commit 1063126164
12 changed files with 36 additions and 14 deletions

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const ChancellorNomination = (socket: Socket, data: any) => { export const ChancellorNomination = (socket: Socket, data: ChancellorNomination) => {
console.log(`ChancellorNomination event`); console.log(`ChancellorNomination event`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const ChancellorPolicy = (socket: Socket, data: any) => { export const ChancellorPolicy = (socket: Socket, data: ChancellorPolicy) => {
console.log(`Chancellor policy`); console.log(`Chancellor policy`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const PresidentPolicies = (socket: Socket, data: any) => { export const PresidentPolicies = (socket: Socket, data: PresidentPolicies) => {
console.log(`Received Presidential policies`); console.log(`Received Presidential policies`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const StartGame = (socket: Socket, data: any) => { export const StartGame = (socket: Socket, data: StartGame) => {
console.log(`Game starting`); console.log(`Game starting`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; 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`); console.log(`President's veto confirmation`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const VetoRequest = (socket: Socket, data: any) => { export const VetoRequest = (socket: Socket, data: VetoRequest) => {
console.log(`Chancellor requesting veto`); console.log(`Chancellor requesting veto`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const Vote = (socket: Socket, data: any) => { export const Vote = (socket: Socket, data: Vote) => {
console.log(`Vote received`); console.log(`Vote received`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const ExecutePlayer = (socket: Socket, data: any) => { export const ExecutePlayer = (socket: Socket, data: ExecutePlayer) => {
console.log(`Killing a player`); console.log(`Killing a player`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; 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`); console.log(`Just a plain ole confirmation`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
export const InvestigateAffiliation = (socket: Socket, data: any) => { export const InvestigateAffiliation = (socket: Socket, data: InvestigateAffiliation) => {
console.log(`Investigating a player`); console.log(`Investigating a player`);
}; };

View file

@ -1,4 +1,4 @@
import { Socket } from 'socket.io'; 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`); console.log(`Choosing the Next President`);
}; };

28
src/types/data.d.ts vendored
View file

@ -1,3 +1,19 @@
interface ExecutePlayer {}
interface InvestigateAffiliation {}
interface NextPresident {}
interface ExecutiveConfirmation {}
interface ChancellorNomination {}
interface ChancellorPolicy {}
interface GetPlayerList {
game_code: string;
}
interface HostGame { interface HostGame {
username: string; username: string;
} }
@ -7,6 +23,12 @@ interface JoinGame {
username: string; username: string;
} }
interface GetPlayerList { interface PresidentPolicies {}
game_code: string;
} interface StartGame {}
interface VetoConfirm {}
interface VetoRequest {}
interface Vote {}