settings_emoji: Fix TypeScript noUncheckedIndexedAccess errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-30 10:07:59 -07:00
parent 11ab831e41
commit d49ad41a68
1 changed files with 2 additions and 0 deletions

View File

@ -221,6 +221,7 @@ function show_modal(): void {
const emoji: Record<string, string> = {}; const emoji: Record<string, string> = {};
function submit_custom_emoji_request(formData: FormData): void { function submit_custom_emoji_request(formData: FormData): void {
assert(emoji.name !== undefined);
void channel.post({ void channel.post({
url: "/json/realm/emoji/" + encodeURIComponent(emoji.name), url: "/json/realm/emoji/" + encodeURIComponent(emoji.name),
data: formData, data: formData,
@ -241,6 +242,7 @@ function show_modal(): void {
for (const obj of $("#add-custom-emoji-form").serializeArray()) { for (const obj of $("#add-custom-emoji-form").serializeArray()) {
emoji[obj.name] = obj.value; emoji[obj.name] = obj.value;
} }
assert(emoji.name !== undefined);
if (emoji.name.trim() === "") { if (emoji.name.trim() === "") {
ui_report.client_error( ui_report.client_error(