I need to keep the property type into my array of object which make up the State.
export interface notification {
date: string;
description: string;
time: string;
title: string;
type: {
icon: string;
typeId: string;
};
}
export interface NotificationsState {
data : notification[];
}
export const initialState: NotificationsState = {
data: [],
};
I process the data this way and send it as the argument of my action this way:
The issue is the action type is overriding the type property of my state:
I would like to have this value type:
type: {
icon: "check_circle",
typeId: "info"
}
but I got this: "[Notifications] updateNotifications"
Which is the type of my action:
export const updateNotifications = createAction(
'[Notifications] updateNotifications',
props<{ notification: notification }>(),
);
I believe NgRx
uses under the hood the keyword type
for handling actions
. Look at the docs
Try changing your property name for Notification
from type
to something else, like notificationType