From 919381e5e78506be95faf35ff9e2060c8ef25bde Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 2 Oct 2023 15:06:31 -0700 Subject: [PATCH] copied_tooltip: Convert module to TypeScript. Signed-off-by: Anders Kaseorg --- tools/test-js-with-node | 2 +- web/src/{copied_tooltip.js => copied_tooltip.ts} | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) rename web/src/{copied_tooltip.js => copied_tooltip.ts} (78%) diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 60f1c0b78e..4a3229a198 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -74,7 +74,7 @@ EXEMPT_FILES = make_set( "web/src/composebox_typeahead.js", "web/src/condense.js", "web/src/confirm_dialog.ts", - "web/src/copied_tooltip.js", + "web/src/copied_tooltip.ts", "web/src/copy_and_paste.js", "web/src/csrf.ts", "web/src/css_variables.js", diff --git a/web/src/copied_tooltip.js b/web/src/copied_tooltip.ts similarity index 78% rename from web/src/copied_tooltip.js rename to web/src/copied_tooltip.ts index ddd88aa722..84af71525f 100644 --- a/web/src/copied_tooltip.js +++ b/web/src/copied_tooltip.ts @@ -2,7 +2,11 @@ import tippy from "tippy.js"; import {$t} from "./i18n"; -export function show_copied_confirmation(copy_button, on_hide_callback, timeout_in_ms = 1000) { +export function show_copied_confirmation( + copy_button: HTMLElement, + on_hide_callback: () => void, + timeout_in_ms = 1000, +): void { // Display a tooltip to notify the user the message or code was copied. const instance = tippy(copy_button, { placement: "top", @@ -18,7 +22,7 @@ export function show_copied_confirmation(copy_button, on_hide_callback, timeout_ }); instance.setContent($t({defaultMessage: "Copied!"})); instance.show(); - function remove_instance() { + function remove_instance(): void { if (!instance.state.isDestroyed) { instance.destroy(); }