use generic

This commit is contained in:
Ticruz
2025-01-24 17:12:58 +01:00
parent 457fdba6cd
commit 218adee0a9
+2 -2
View File
@@ -678,8 +678,8 @@ export const fromPairs = <T>(pairs: [k?: string, v?: T, ...args: unknown[]][]) =
* @param x - Object to filter * @param x - Object to filter
* @returns Object with only values that pass predicate * @returns Object with only values that pass predicate
*/ */
export const filterVals = (f: (v: any) => boolean, x: Record<string, any>) => { export const filterVals = <T extends Record<string, any>>(f: (v: any) => boolean, x: T) => {
const r = {} as Record<string, any> const r = {} as T
for (const k in x) { for (const k in x) {
if (f(x[k])) { if (f(x[k])) {