minor tweaks for ui/game types

This commit is contained in:
Niklas Fiekas 2017-04-04 21:35:09 +02:00
parent 9e6c28c742
commit bd55f85fe2
2 changed files with 6 additions and 6 deletions

View file

@ -52,14 +52,14 @@ export function resignable(data: Data): boolean {
// can the current player go berserk?
export function berserkableBy(data: Data): boolean {
return data.tournament &&
return !!data.tournament &&
data.tournament.berserkable &&
isPlayerPlaying(data) &&
!bothPlayersHavePlayed(data);
}
export function moretimeable(data: Data): boolean {
return data.clock && isPlayerPlaying(data) && !mandatory(data);
return !!data.clock && isPlayerPlaying(data) && !mandatory(data);
}
export function imported(data: Data): boolean {

View file

@ -3,10 +3,10 @@ export interface Data {
player: Player;
opponent: Player;
spectator: boolean;
tournament: Tournament;
simul: Simul;
tournament?: Tournament;
simul?: Simul;
takebackable: boolean;
clock: Clock;
clock?: Clock;
}
export interface Game {
@ -30,7 +30,7 @@ export type StatusName = 'started' | 'aborted' | 'mate' | 'resign' |
'stalemate' | 'timeout' | 'draw' | 'outoftime' |
'noStart' | 'cheat' | 'variantEnd';
export type StatusId = 0;
export type StatusId = number;
export interface Player {
id: string;