mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-04-22 14:19:41 +00:00
feat: enable stricter typescript compiler options
This commit is contained in:
@@ -20,7 +20,7 @@ export function groupBy<T>(collection: T[], group: (item: T) => string | undefin
|
||||
return collection.reduce((accumulator: Record<string, T[]>, item) => {
|
||||
const key = group(item) ?? '';
|
||||
accumulator[key] = accumulator[key] ?? [];
|
||||
accumulator[key].push(item);
|
||||
accumulator[key]!.push(item);
|
||||
return accumulator;
|
||||
}, {});
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export function shuffle<T>(array: T[]): T[] {
|
||||
const out = [];
|
||||
|
||||
while (copy.length > 0) {
|
||||
out.push(copy.splice(Math.floor(Math.random() * copy.length), 1)[0]);
|
||||
out.push(copy.splice(Math.floor(Math.random() * copy.length), 1)[0]!);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
* Zip two arrays together.
|
||||
*/
|
||||
export function zip<T, U>(a: T[], b: U[]): [T, U][] {
|
||||
return a.map((_, i) => [a[i], b[i]]);
|
||||
return a.map((_, i) => [a[i]!, b[i]!]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user