Skip to content

Commit

Permalink
Fix: TS2322 - Type of onClose prop.
Browse files Browse the repository at this point in the history
  • Loading branch information
burnettk committed Feb 6, 2025
1 parent 618d081 commit 63758a2
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -45,7 +46,9 @@ export function Notification({

if (timeout && onClose) {
setTimeout(() => {
onClose();
if (onClose) {
onClose(new Event('timeout'), 'timeout');
}
}, timeout);
}

Expand Down

0 comments on commit 63758a2

Please sign in to comment.