From 8a53a39c426e95164e87a3b0857eb420711bfd85 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 11 Dec 2024 09:29:04 +0100 Subject: Fix a number of typescript errors (#32773) Fixes 96 typescript errors. Behaviour changes are commented below. --------- Co-authored-by: wxiaoguang --- web_src/js/modules/toast.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'web_src/js/modules') diff --git a/web_src/js/modules/toast.ts b/web_src/js/modules/toast.ts index 264ccbbdce..36e2321743 100644 --- a/web_src/js/modules/toast.ts +++ b/web_src/js/modules/toast.ts @@ -5,6 +5,9 @@ import Toastify from 'toastify-js'; // don't use "async import", because when ne import type {Intent} from '../types.ts'; import type {SvgName} from '../svg.ts'; import type {Options} from 'toastify-js'; +import type StartToastifyInstance from 'toastify-js'; + +export type Toast = ReturnType; type ToastLevels = { [intent in Intent]: { @@ -38,7 +41,7 @@ type ToastOpts = { } & Options; // See https://github.com/apvarun/toastify-js#api for options -function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}) { +function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast { const body = useHtmlBody ? String(message) : htmlEscape(message); const key = `${level}-${body}`; @@ -75,14 +78,14 @@ function showToast(message: string, level: Intent, {gravity, position, duration, return toast; } -export function showInfoToast(message: string, opts?: ToastOpts) { +export function showInfoToast(message: string, opts?: ToastOpts): Toast { return showToast(message, 'info', opts); } -export function showWarningToast(message: string, opts?: ToastOpts) { +export function showWarningToast(message: string, opts?: ToastOpts): Toast { return showToast(message, 'warning', opts); } -export function showErrorToast(message: string, opts?: ToastOpts) { +export function showErrorToast(message: string, opts?: ToastOpts): Toast { return showToast(message, 'error', opts); } -- cgit v1.2.3