function sumByKey sumByKey<T,K,>(keyOf: (item: T) => K,amountOf: (item: T) => number,): unknown Curried group-and-sum: accumulate valueOf(item) into a Map keyed by keyOf(item). Replaces the common pattern: const m = new Map(); for (const x of xs) m.set(k(x), (m.get(k(x)) ?? 0) + v(x)) Type Parameters T K Parameters keyOf: (item: T) => K amountOf: (item: T) => number Return Type unknown