Fix: TS2322 - Type of onClose prop.

This commit is contained in:
burnettk 2025-02-06 13:08:31 -05:00 committed by burnettk (aider)
parent 618d081a2f
commit 63758a27ed
No known key found for this signature in database

View File

@ -8,11 +8,12 @@ import IconButton from '@mui/material/IconButton';
import Snackbar from '@mui/material/Snackbar';
import Alert from '@mui/material/Alert';
import { ObjectWithStringKeysAndValues } from '../interfaces';
import { SnackbarCloseReason } from '@mui/material';
type OwnProps = {
title: string;
children?: React.ReactNode;
onClose?: Function;
onClose?: (event: Event | React.SyntheticEvent<any, Event>, reason: SnackbarCloseReason) => void;
type?: 'success' | 'error' | 'warning';
hideCloseButton?: boolean;
allowTogglingFullMessage?: boolean;
@ -45,7 +46,9 @@ export function Notification({
if (timeout && onClose) {
setTimeout(() => {
onClose();
if (onClose) {
onClose(new Event('timeout'), 'timeout');
}
}, timeout);
}