From c11d0103d8f2632a570e8d31ad2b27e775693d1a Mon Sep 17 00:00:00 2001 From: gbtami Date: Thu, 19 Dec 2024 14:56:49 +0100 Subject: [PATCH] Typing fixes --- client/lobby.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/client/lobby.ts b/client/lobby.ts index ebd4f9db6..08ba5769a 100644 --- a/client/lobby.ts +++ b/client/lobby.ts @@ -23,7 +23,7 @@ import { handleOngoingGameEvents, Game, gameViewPlaying, compareGames } from './ import { createWebsocket } from "@/socket/webSocketUtils"; -const autoPairingTCs = [ +const autoPairingTCs: [number, number, number][] = [ [1, 0, 0], [3, 0, 0], [3, 2, 0], @@ -564,7 +564,7 @@ export class LobbyController implements ChatController { } autoPairingSubmit() { - const variants = []; + const variants: [string, boolean][] = []; document.querySelectorAll('input[name^="va_"]').forEach((inp: HTMLInputElement) => { localStorage[inp.name] = inp.checked; if (inp.checked) { @@ -574,8 +574,8 @@ export class LobbyController implements ChatController { } }) - const tcs = []; - document.querySelectorAll('input[name^="tc_"]').forEach((inp: HTMLInputElement, index) => { + const tcs: [number, number, number][] = []; + document.querySelectorAll('input[name^="tc_"]').forEach((inp: HTMLInputElement, index: number) => { localStorage[inp.name] = inp.checked; if (inp.checked) tcs.push(autoPairingTCs[index]); }) @@ -948,12 +948,7 @@ export class LobbyController implements ChatController { } renderAutoPairingTable() { - // TODO: load/save from localStorage - // TODO: call createAutoPairing() on clicking SUBMIT button - const asVariants = localStorage.auto_seek_variants ?? ""; - const asTCs = localStorage.auto_seek_tcs ?? ""; - - const variantList = []; + const variantList: VNode[] = []; enabledVariants.forEach(v => { const variant = VARIANTS[v]; let variantName = variant.name; @@ -968,7 +963,7 @@ export class LobbyController implements ChatController { } }) - const tcList = []; + const tcList: VNode[] = []; autoPairingTCs.forEach(v => { const tcName = timeControlStr(v[0], v[1], v[2]); const checked = localStorage[`tc_${tcName}`] ?? "false";