fix(idl_gen_ts): bool to number conversion in mutable API (#8677)

Co-authored-by: Björn Harrtell <bjornharrtell@users.noreply.github.com>
diff --git a/src/idl_gen_ts.cpp b/src/idl_gen_ts.cpp
index 835ba44..14d42dc 100644
--- a/src/idl_gen_ts.cpp
+++ b/src/idl_gen_ts.cpp
@@ -1903,12 +1903,13 @@
           code += "    return false;\n";
           code += "  }\n\n";
 
-          // special case for bools, which are treated as uint8
           code +=
               "  " + GenBBAccess() + write_method + "(this.bb_pos + offset, ";
-          if (field.value.type.base_type == BASE_TYPE_BOOL) { code += "+"; }
         }
 
+        // special case for bools, which are treated as uint8
+        if (field.value.type.base_type == BASE_TYPE_BOOL) { code += "+"; }
+        
         code += "value);\n";
         code += "  return true;\n";
         code += "}\n\n";