backend: add missing return type annotation in array.ts

This commit is contained in:
Norm 2022-10-11 01:51:17 -04:00
parent 02079593d5
commit c65559872b
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE

View file

@ -84,7 +84,7 @@ export function groupOn<T, S>(f: (x: T) => S, xs: T[]): T[][] {
return groupBy((a, b) => f(a) === f(b), xs); return groupBy((a, b) => f(a) === f(b), xs);
} }
export function groupByX<T>(collections: T[], keySelector: (x: T) => string) { export function groupByX<T>(collections: T[], keySelector: (x: T) => string): Record<string, T[]> {
return collections.reduce((obj: Record<string, T[]>, item: T) => { return collections.reduce((obj: Record<string, T[]>, item: T) => {
const key = keySelector(item); const key = keySelector(item);
if (!Object.prototype.hasOwnProperty.call(obj, key)) { if (!Object.prototype.hasOwnProperty.call(obj, key)) {