Fix mysterious type errors

This commit is contained in:
Kalle (Sendou)
2021-06-17 22:27:35 +03:00
parent ed4da7bc8f
commit 21b22e63eb
3 changed files with 6 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import { shuffleArray } from "utils/arrays";
import { Player, Match } from "./types";
const choosePlayersToSitOut = (
players: Player[]

View File

@@ -1,5 +1,6 @@
import { useEffect, useReducer } from "react";
import { createNewMatch, teamsShouldChange, errorWithPlayers } from "./helpers";
import { State, Action } from "./types";
const DEFAULT_AMOUNT_OF_ROUNDS_WITH_SAME_TEAMS = 2;

View File

@@ -1,4 +1,4 @@
interface Player {
export interface Player {
id: number;
name: string;
winCount: number;
@@ -6,14 +6,14 @@ interface Player {
sittingOutCount: number;
}
type Match = {
export type Match = {
alpha: string[];
bravo: string[];
spectators: string[];
winner?: "alpha" | "bravo";
};
interface State {
export interface State {
players: Player[];
matches: Match[];
amountOfRoundsWithSameTeams: number;
@@ -21,9 +21,7 @@ interface State {
noPlacingToSameTeam: [playerOneId?: number, playerTwoId?: number];
}
// TODO: names must be unique
type Action =
export type Action =
| {
type: "SET_PLAYER";
name: string;