diff --git a/ui/analyse/src/study/relay/relayTourView.ts b/ui/analyse/src/study/relay/relayTourView.ts index 7598a352ec8b1..d1406e4313e02 100644 --- a/ui/analyse/src/study/relay/relayTourView.ts +++ b/ui/analyse/src/study/relay/relayTourView.ts @@ -142,7 +142,7 @@ const dateFormat = memoize(() => ? new Intl.DateTimeFormat(site.displayLocale, { month: 'short', day: '2-digit', - } as any).format + }).format : (d: Date) => d.toLocaleDateString(), ); diff --git a/ui/editor/src/view.ts b/ui/editor/src/view.ts index f55c0a8d655fc..0c4bf518023c3 100644 --- a/ui/editor/src/view.ts +++ b/ui/editor/src/view.ts @@ -363,7 +363,7 @@ function sparePieces(ctrl: EditorCtrl, color: Color, _orientation: Color, positi mousedown: onSelectSparePiece(ctrl, s, 'mouseup'), touchstart: onSelectSparePiece(ctrl, s, 'touchend'), touchmove: e => { - lastTouchMovePos = eventPosition(e as any); + lastTouchMovePos = eventPosition(e); }, }, }, diff --git a/ui/round/src/ctrl.ts b/ui/round/src/ctrl.ts index d4487843f988f..629d681b0a270 100644 --- a/ui/round/src/ctrl.ts +++ b/ui/round/src/ctrl.ts @@ -287,7 +287,7 @@ export default class RoundController implements MoveRootCtrl { isLate = (): boolean => this.replaying() && status.playing(this.data); playerAt = (position: Position): game.Player => - (this.flip as any) ^ ((position === 'top') as any) ? this.data.opponent : this.data.player; + this.flip != (position === 'top') ? this.data.opponent : this.data.player; flipNow = (): void => { this.flip = !this.nvui && !this.flip; diff --git a/ui/swiss/src/interfaces.ts b/ui/swiss/src/interfaces.ts index 6eed87a19cab2..6c4fb20a31708 100644 --- a/ui/swiss/src/interfaces.ts +++ b/ui/swiss/src/interfaces.ts @@ -79,6 +79,8 @@ export interface Standing { export type Outcome = 'absent' | 'late' | 'bye'; +export type Sheet = (PairingBase | Outcome)[]; + export interface BasePlayer { user: LightUser; rating: number; @@ -97,7 +99,7 @@ export interface PodiumPlayer extends BasePlayer { export interface Player extends BasePlayer { rank: number; sheetMin: string; - sheet: (PairingBase | Outcome)[]; + sheet: Sheet; } export interface Board { diff --git a/ui/swiss/src/util.ts b/ui/swiss/src/util.ts index 8ace884fd8b1f..0ab5b3bc7224e 100644 --- a/ui/swiss/src/util.ts +++ b/ui/swiss/src/util.ts @@ -1,3 +1,3 @@ -import { Outcome } from './interfaces'; +import { Outcome, PairingExt } from './interfaces'; -export const isOutcome = (s: any): s is Outcome => s == 'absent' || s == 'late' || s == 'bye'; +export const isOutcome = (s: PairingExt | string): s is Outcome => s == 'absent' || s == 'late' || s == 'bye'; diff --git a/ui/swiss/src/view/playerInfo.ts b/ui/swiss/src/view/playerInfo.ts index e42aa4cfdaae6..e9bc10d10e4f5 100644 --- a/ui/swiss/src/view/playerInfo.ts +++ b/ui/swiss/src/view/playerInfo.ts @@ -15,10 +15,10 @@ export default function (ctrl: SwissCtrl): VNode | undefined { const tag = 'div.swiss__player-info.swiss__table'; if (data?.user.id !== ctrl.playerInfoId) return h(tag, [h('div.stats', [h('h2', ctrl.playerInfoId), spinner()])]); - const games = data.sheet.filter((p: any) => p.g).length; - const wins = data.sheet.filter((p: any) => p.w).length; + const games = data.sheet.filter(p => !isOutcome(p) && p.g).length; + const wins = data.sheet.filter(p => !isOutcome(p) && p.w).length; const avgOp: number | undefined = games - ? Math.round(data.sheet.reduce((r, p) => r + ((p as any).rating || 1), 0) / games) + ? Math.round(data.sheet.reduce((r, p) => r + (!isOutcome(p) ? p.rating : 1), 0) / games) : undefined; return h(tag, { hook: { insert: setup, postpatch: (_, vnode) => setup(vnode) } }, [ h('a.close', { diff --git a/ui/swiss/src/xhr.ts b/ui/swiss/src/xhr.ts index 9323d059dff7d..e94980ca99d12 100644 --- a/ui/swiss/src/xhr.ts +++ b/ui/swiss/src/xhr.ts @@ -2,6 +2,7 @@ import { throttlePromiseDelay } from 'common/timing'; import { json, form } from 'common/xhr'; import SwissCtrl from './ctrl'; import { isOutcome } from './util'; +import { Sheet } from './interfaces'; // when the tournament no longer exists const onFail = () => site.reload(); @@ -41,7 +42,7 @@ const playerInfo = (ctrl: SwissCtrl, userId: string) => ctrl.redraw(); }, onFail); -const readSheetMin = (str: string) => +const readSheetMin = (str: string): Sheet => str ? str.split('|').map(s => isOutcome(s) diff --git a/ui/voice/src/move/arrows.ts b/ui/voice/src/move/arrows.ts index a9ce29cbbcd5a..89f8e2aa029ab 100644 --- a/ui/voice/src/move/arrows.ts +++ b/ui/voice/src/move/arrows.ts @@ -60,9 +60,9 @@ export function coloredArrows(choices: [string, Uci][], timer: number | undefine function timerShape(duration: number, color: string, alpha = 0.4) { // works around a firefox stroke-dasharray animation bug setTimeout(() => { - for (const anim of $('.voice-timer-arc').get() as any[]) { - anim?.beginElement(); - anim?.parentElement!.setAttribute('visibility', 'visible'); + for (const anim of document.querySelectorAll('animate .voice-timer-arc')) { + anim.beginElement(); + anim.parentElement?.setAttribute('visibility', 'visible'); if (color === 'grey') return; // don't show numbered arrow outlines } });