I use @reduxjs/toolkit
and my state contains: allSlides: ISlide[];
When I try to change anything in allSlides
like ex.
setAllSlides(state, action: PayloadAction<ISlide[]>) {
state.allSlides = action.payload;
},
storeNewSlide(state, action: PayloadAction<ISlide>) {
state.allSlides.push(action.payload);
},
I get a TS error
Type 'ISlide' is not assignable to type 'WritableDraft<ISlide>'
I don't have problem with changing array of primitive values or just one property in objects, but I don't know how to change correctly whole array or specific object in array.