Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stats: Fix implicit use of any.

Anders Kaseorg5b92fbacaa38
diff --git a/web/src/stats/stats.ts b/web/src/stats/stats.ts
index 1065c390d67..5b0b12b2ad2 100644
--- a/web/src/stats/stats.ts
+++ b/web/src/stats/stats.ts
@@ -1378,11 +1378,13 @@ function get_chart_data(
data,
success(data) {
callback(data);
- update_last_full_update(data.end_times);
+ const {end_times} = z.object({end_times: z.array(z.number())}).parse(data);
+ update_last_full_update(end_times);
},
error(xhr) {
- if (xhr.responseJSON?.msg) {
- $("#id_stats_errors").show().text(xhr.responseJSON.msg);
+ const parsed = z.object({msg: z.string()}).safeParse(xhr.responseJSON);
+ if (parsed.success) {
+ $("#id_stats_errors").show().text(parsed.data.msg);
}
},
});