From: Ian Jackson Date: Fri, 16 Apr 2021 15:36:54 +0000 (+0100) Subject: js: Fix two errors reported by ts 4.x X-Git-Tag: otter-0.5.0~39 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b8fa0bd5d9d1e0224e0634af38236ee321c5eec3;p=otter.git js: Fix two errors reported by ts 4.x templates/script.ts:898:7: error TS7034: Variable 'held' implicitly has type 'any' in some locations where its type cannot be determined. templates/script.ts:954:32: error TS7005: Variable 'held' implicitly has an 'any' type. Reported-by: Matthew Vernon Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index f1f8e0d0..d5c9d309 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -895,7 +895,7 @@ function mouse_find_predicate( predicate: (p: PieceInfo) => boolean ): MouseFindClicked { let clicked: PieceId[]; - let held; + let held: string | null; let pinned = false; let already_count = 0; @@ -932,7 +932,7 @@ function mouse_find_predicate( held = p.held; if (held == us && !allow_for_deselect) held = null; } - if (held == us) { + if (held! == us) { // user is going to be deselecting if (p.held != us) { // skip ones we don't have