не мога да сложа на quentity новата стойност, няма грешки в brawsera
export interface CartState {
readonly cars: CartCarModel[]
}
export class CartCarModel {
constructor (
public carId: string,
public carModel: string,
public quantity: number,
public price: number) { }
}
const initialState: CartState = {
cars: []
}
function reducerFunction(state: CartState, id: string, quantity: number) {
const nextState = produce(state, draft => {
draft.cars.map(ops => {
if (ops.carId === id) {
return {...ops, quantity: quantity}
}
else { return ops }
})
})