Fix mapVals types

This commit is contained in:
Jon Staab
2024-09-19 14:12:01 -07:00
parent 8230d7a9f6
commit f246e9914a
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -77,14 +77,14 @@ export const mapKeys = <T extends Record<string, any>>(f: (v: string) => string,
return r as T
}
export const mapVals = <T extends Record<string, any>>(f: (v: any) => any, x: T) => {
const r: Record<string, any> = {}
export const mapVals = <V, U>(f: (v: V) => U, x: Record<string, V>) => {
const r: Record<string, U> = {}
for (const [k, v] of Object.entries(x)) {
r[k] = f(v)
}
return r as T
return r
}
export const mergeLeft = <T extends Record<string, any>>(a: T, b: T) => ({...b, ...a})