@@ -43,7 +43,7 @@ type ToastOpts = {
43
43
type ToastifyElement = HTMLElement & { _giteaToastifyInstance ?: Toast } ;
44
44
45
45
/** 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 {
47
47
const body = useHtmlBody ? message : htmlEscape ( message ) ;
48
48
const parent = document . querySelector ( '.ui.dimmer.active' ) ?? document . body ;
49
49
const duplicateKey = preventDuplicates ? ( preventDuplicates === true ? `${ level } -${ body } ` : preventDuplicates ) : '' ;
@@ -56,7 +56,7 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
56
56
showElem ( toastDupNumEl ) ;
57
57
toastDupNumEl . textContent = String ( Number ( toastDupNumEl . textContent ) + 1 ) ;
58
58
animateOnce ( toastDupNumEl , 'pulse-1p5-200' ) ;
59
- return ;
59
+ return null ;
60
60
}
61
61
}
62
62
@@ -83,15 +83,15 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
83
83
return toast ;
84
84
}
85
85
86
- export function showInfoToast ( message : string , opts ?: ToastOpts ) : Toast {
86
+ export function showInfoToast ( message : string , opts ?: ToastOpts ) : Toast | null {
87
87
return showToast ( message , 'info' , opts ) ;
88
88
}
89
89
90
- export function showWarningToast ( message : string , opts ?: ToastOpts ) : Toast {
90
+ export function showWarningToast ( message : string , opts ?: ToastOpts ) : Toast | null {
91
91
return showToast ( message , 'warning' , opts ) ;
92
92
}
93
93
94
- export function showErrorToast ( message : string , opts ?: ToastOpts ) : Toast {
94
+ export function showErrorToast ( message : string , opts ?: ToastOpts ) : Toast | null {
95
95
return showToast ( message , 'error' , opts ) ;
96
96
}
97
97
0 commit comments