I have a simple reducer function
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { TSnackBarProps } from 'plugins/notification/NotificationContext';
import { MAX_STACK } from 'plugins/notification/NotificationsStack';
interface INotificationState {
notifications: TSnackBarProps[];
}
const initialState: INotificationState = {
notifications: [],
};
const notificationSlice = createSlice({
name: 'notification',
initialState,
reducers: {
addNewNotification(state, action: PayloadAction<TSnackBarProps>) {
const { notifications } = state;
const { payload: notification } = action;
if (notifications.find((n) => n.severity === notification.severity && n.key === notification.key)) {
return;
}
if (notifications.length >= MAX_STACK) {
notifications.splice(0, notifications.length - MAX_STACK);
}
state.notifications.push(notification);
},
},
});
export default notificationSlice.reducer;
But, it throws the error as shown below:

I am just starting to write this reducer and got stuck here. Thanks for your help.
Also, TSnackBarProps is just SnackBarProps type from material-ui with severity property added.
readonly string[]instead ofstring[]