Cześć, nie mogę poprawnie użyć funkcji reduce w typescript. Oto mój kod :
const balance: number = transactions
.filter(transaction => category === transaction.category && startTime <= transaction.time && transaction.time <= endTime)
.reduce((a, b) => { a.amount + b.amount})
Do momentu .reduce
w konsoli nie ma błędów za to reduce wywala to :
Argument of type '(a: Transaction, b: Transaction) => void' is not assignable to parameter of type '(previousValue: Transaction, currentValue: Transaction, currentIndex: number, array: Transaction[]) => Transaction'.
Type 'void' is not assignable to type 'Transaction'.