diff --git a/web/src/feedback_widget.ts b/web/src/feedback_widget.ts index dca3aa76f5..25fba86821 100644 --- a/web/src/feedback_widget.ts +++ b/web/src/feedback_widget.ts @@ -28,14 +28,14 @@ type FeedbackWidgetMeta = { $container: JQuery | null; opened: boolean; handlers_set?: boolean; - undo?: () => void; + undo: (() => void) | undefined; }; type FeedbackWidgetOptions = { populate: (element: JQuery) => void; title_text: string; - undo_button_text: string; - on_undo: () => void; + undo_button_text?: string; + on_undo?: () => void; }; const meta: FeedbackWidgetMeta = { @@ -43,6 +43,7 @@ const meta: FeedbackWidgetMeta = { alert_hover_state: false, $container: null, opened: false, + undo: undefined, }; const animate = { @@ -171,7 +172,7 @@ export function show(opts: FeedbackWidgetOptions): void { meta.hide_me_time = Date.now() + 4000; meta.$container.find(".feedback_title").text(opts.title_text); - meta.$container.find(".feedback_undo").text(opts.undo_button_text); + meta.$container.find(".feedback_undo").text(opts.undo_button_text ?? ""); opts.populate(meta.$container.find(".feedback_content")); animate.fadeIn();