pl-fe: Fix types

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-11-03 20:02:01 +01:00
parent 89f91d6e3c
commit d355651813
4 changed files with 6 additions and 5 deletions

View file

@ -1,5 +1,4 @@
import IntlMessageFormat from 'intl-messageformat';
import 'intl-pluralrules';
import { defineMessages } from 'react-intl';

View file

@ -19,7 +19,7 @@ import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch';
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
import { useInstance } from 'pl-fe/hooks/use-instance';
import { useLoggedIn } from 'pl-fe/hooks/use-logged-in';
import { makeGetNotification, SelectedNotification } from 'pl-fe/selectors';
import { makeGetNotification } from 'pl-fe/selectors';
import { useModalsStore } from 'pl-fe/stores/modals';
import { useSettingsStore } from 'pl-fe/stores/settings';
import { NotificationType } from 'pl-fe/utils/notification';
@ -188,7 +188,7 @@ interface INotification {
onReblog?: (status: StatusEntity, e?: KeyboardEvent) => void;
}
const getNotificationStatus = (n: SelectedNotification) => {
const getNotificationStatus = (n: Pick<NotificationGroup, 'type'> & ({ status: StatusEntity } | { })) => {
if (['mention', 'status', 'reblog', 'favourite', 'poll', 'update', 'emoji_reaction', 'event_reminder', 'participation_accepted', 'participation_request'].includes(n.type))
// @ts-ignore
return n.status;

View file

@ -30,7 +30,7 @@ import type { Notification as BaseNotification, Markers, NotificationGroup, Pagi
import type { AnyAction } from 'redux';
const QueuedNotificationRecord = ImmutableRecord({
notification: {} as any as NotificationGroup,
notification: {} as any as BaseNotification,
intlMessages: {} as Record<string, string>,
intlLocale: '',
});
@ -175,7 +175,7 @@ const deleteByStatus = (state: State, statusId: string) =>
// @ts-ignore
state.update('items', map => map.filterNot(item => item !== null && item.status === statusId));
const updateNotificationsQueue = (state: State, notification: NotificationGroup, intlMessages: Record<string, string>, intlLocale: string) => {
const updateNotificationsQueue = (state: State, notification: BaseNotification, intlMessages: Record<string, string>, intlLocale: string) => {
const queuedNotifications = state.queuedNotifications;
const listedNotifications = state.items;
const totalQueuedNotificationsCount = state.totalQueuedNotificationsCount;

View file

@ -185,7 +185,9 @@ const makeGetNotification = () => createSelector([
(state: RootState, notification: NotificationGroup) => selectAccounts(state, notification.sample_account_ids),
], (notification, target, status, accounts): SelectedNotification => ({
...notification,
// @ts-ignore
target,
// @ts-ignore
status,
accounts,
}));