I'm trying to do a .map function into a state array in Redux with Typescript, the problem is that it's throwing an error
[ts] Property 'id' does not exist on type 'never'
in the landing.id if statement, since its an array of objects the code makes sense for me but seems that I'm missing something there
export default function landingReducer (state = [], action) {
switch(action.type) {
case ActionTypes.ADD_LANDING:
return [...state, action.landing]
case ActionTypes.EDIT_LANDING:
return state.map(landing => {
if (action.landing.id == landing.id) {
return landing;
}
})
Thanks in advance!