drafts: Fix implicit use of any.

Attempting to convert .data("draft-id") to .attr mysteriously breaks
draft saving, so I’ll leave that for future work.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-06 15:45:09 -07:00 committed by Tim Abbott
parent 3fc5800d53
commit 467e5a4361
1 changed files with 3 additions and 2 deletions

View File

@ -389,8 +389,9 @@ type UpdateDraftOptions = {
}; };
export function update_draft(opts: UpdateDraftOptions = {}): string | undefined { export function update_draft(opts: UpdateDraftOptions = {}): string | undefined {
const draft_id = $("textarea#compose-textarea").data("draft-id"); const draft_id: unknown = $("textarea#compose-textarea").data("draft-id");
const old_draft = draft_model.getDraft(draft_id); assert(draft_id === undefined || typeof draft_id === "string");
const old_draft = draft_id === undefined ? undefined : draft_model.getDraft(draft_id);
const no_notify = opts.no_notify ?? false; const no_notify = opts.no_notify ?? false;
const draft = snapshot_message(); const draft = snapshot_message();