Skip to content

Commit

Permalink
feat: changed types to interfaces | added gameType | import FinishedG…
Browse files Browse the repository at this point in the history
…ameState | import PlayerI | import TGameType #190
  • Loading branch information
Храмыцких Антон committed Aug 20, 2023
1 parent abbc675 commit 838386d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions contexts/GameStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// // console.log('FINISH GameResult FinishedGameState', FinishedGameState)
// // console.log('FINISH GameResult finishGameCheckResult', finishGameCheckResult);

import {PlayerI, TGameType} from 'types/game';
import {FinishedGameState} from "../gameApi";

export const GameStateContextDefault: GameStateType = {
finishGameCheckResult: null,
finishedGameState: null,
Expand All @@ -20,17 +23,21 @@ export const GameStateContextDefault: GameStateType = {
isDraw: false,
disqualified: null,
resigned: null,
players: null,

};

export type GameStateType = {
finishGameCheckResult: null;
finishedGameState: null;
export interface GameStateType {
finishGameCheckResult: null | { winner: boolean; isDraw: boolean; cheatWin: boolean };
finishedGameState: FinishedGameState | null;
gameId: number;
winner: string | null;
loser: string | null;
isDraw: boolean;
disqualified: string | null;
resigned: string | null;
players: PlayerI[] | null;
gameType?: TGameType;
};


Expand Down

0 comments on commit 838386d

Please sign in to comment.