chiark / gitweb /
js: Fix two errors reported by ts 4.x
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Apr 2021 15:36:54 +0000 (16:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Apr 2021 16:08:14 +0000 (17:08 +0100)
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 <matthewv@chiark.greenend.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index f1f8e0d0d682c987679565810090bd48a42ac0af..d5c9d309fe566c6c98faab2866002557bbaad8ac 100644 (file)
@@ -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