@@ -43,7 +43,7 @@ type ToastOpts = {
4343type ToastifyElement = HTMLElement & { _giteaToastifyInstance ?: Toast } ;
4444
4545/** See https://github.com/apvarun/toastify-js#api for options */
46- function showToast ( message : string , level : Intent , { gravity, position, duration, useHtmlBody, preventDuplicates = true , ...other } : ToastOpts = { } ) : Toast {
46+ function showToast ( message : string , level : Intent , { gravity, position, duration, useHtmlBody, preventDuplicates = true , ...other } : ToastOpts = { } ) : Toast | null {
4747 const body = useHtmlBody ? message : htmlEscape ( message ) ;
4848 const parent = document . querySelector ( '.ui.dimmer.active' ) ?? document . body ;
4949 const duplicateKey = preventDuplicates ? ( preventDuplicates === true ? `${ level } -${ body } ` : preventDuplicates ) : '' ;
@@ -56,7 +56,7 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
5656 showElem ( toastDupNumEl ) ;
5757 toastDupNumEl . textContent = String ( Number ( toastDupNumEl . textContent ) + 1 ) ;
5858 animateOnce ( toastDupNumEl , 'pulse-1p5-200' ) ;
59- return ;
59+ return null ;
6060 }
6161 }
6262
@@ -83,15 +83,15 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
8383 return toast ;
8484}
8585
86- export function showInfoToast ( message : string , opts ?: ToastOpts ) : Toast {
86+ export function showInfoToast ( message : string , opts ?: ToastOpts ) : Toast | null {
8787 return showToast ( message , 'info' , opts ) ;
8888}
8989
90- export function showWarningToast ( message : string , opts ?: ToastOpts ) : Toast {
90+ export function showWarningToast ( message : string , opts ?: ToastOpts ) : Toast | null {
9191 return showToast ( message , 'warning' , opts ) ;
9292}
9393
94- export function showErrorToast ( message : string , opts ?: ToastOpts ) : Toast {
94+ export function showErrorToast ( message : string , opts ?: ToastOpts ) : Toast | null {
9595 return showToast ( message , 'error' , opts ) ;
9696}
9797
0 commit comments