ts: Convert `confirm_dialog` module to TypeScript.

This commit is contained in:
Lalit 2023-05-18 19:31:57 +05:30 committed by Tim Abbott
parent 271df2c98e
commit a3f46957bc
3 changed files with 5 additions and 4 deletions

View File

@ -72,7 +72,7 @@ EXEMPT_FILES = make_set(
"web/src/compose_validate.js",
"web/src/composebox_typeahead.js",
"web/src/condense.js",
"web/src/confirm_dialog.js",
"web/src/confirm_dialog.ts",
"web/src/copy_and_paste.js",
"web/src/csrf.ts",
"web/src/css_variables.js",

View File

@ -1,7 +1,8 @@
import * as dialog_widget from "./dialog_widget";
import type {DialogWidgetConfig} from "./dialog_widget";
import {$t_html} from "./i18n";
export function launch(conf) {
export function launch(conf: DialogWidgetConfig): void {
dialog_widget.launch({
...conf,
close_on_submit: true,

View File

@ -43,7 +43,7 @@ import * as ui_report from "./ui_report";
* to DOM, it can do so by passing a post_render hook.
*/
type WidgetConfig = {
export type DialogWidgetConfig = {
html_heading: string;
html_body: string;
on_click: (e: unknown) => void;
@ -97,7 +97,7 @@ export function close_modal(on_hidden_callback?: () => void): void {
overlays.close_modal("dialog_widget_modal", {on_hidden: on_hidden_callback});
}
export function launch(conf: WidgetConfig): void {
export function launch(conf: DialogWidgetConfig): void {
// Mandatory fields:
// * html_heading
// * html_body