Hello I have this reduce function in project I am currently working on and I can't figure out how to type it properly.
I am just trying to get price of all products in cart.
const totalPrice: number = carted.reduce(acc: number, product: CartedProductType) => (acc += product.price * product.quantity), 0);
and I am geting this error.
Argument of type '(acc: number, product: CartedProductType) => number' is not assignable to parameter of type '(previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never'.
Type 'number' is not assignable to type 'never'
I am fairly new to typescript and coding overall but I have tried to google out the problem but nothing worked for me so far.
Thank you for help