similar to recordMap, but made for variable number of function argument parameters. also see RecordArgsMapper to get an understanding of what mapping_funcs is supposed to look like, and how to type it.
mapping_funcs
type Vec1 = [number]type Vec2 = [number, number]type Vec3 = [number, number, number]const now_i_know_my = { a: [1] as Vec1, b: [2, 2] as Vec2, c: [3, 4, 5] as Vec3, s: ["nein" as string, "mein", "fuhrer"] as const }const now_i_know_my_fuhrer = recordArgsMap({ a: (v0) => v0 ** 2, b: (...vs) => vs[0] + vs[1] ** 2, c: (v0, v1, v2) => v0 ** 0.5 + v1 + v2 ** 2, s: (arg0, ...args) => [arg0 === "nein" ? 9 : arg0, ...args] as const}, now_i_know_my)// assert typeof now_i_know_my_fuhrer extends { a: number, b: number, c: number, s: readonly [string | 9, "mein", "fuhrer"] }console.debug(now_i_know_my_fuhrer) Copy
type Vec1 = [number]type Vec2 = [number, number]type Vec3 = [number, number, number]const now_i_know_my = { a: [1] as Vec1, b: [2, 2] as Vec2, c: [3, 4, 5] as Vec3, s: ["nein" as string, "mein", "fuhrer"] as const }const now_i_know_my_fuhrer = recordArgsMap({ a: (v0) => v0 ** 2, b: (...vs) => vs[0] + vs[1] ** 2, c: (v0, v1, v2) => v0 ** 0.5 + v1 + v2 ** 2, s: (arg0, ...args) => [arg0 === "nein" ? 9 : arg0, ...args] as const}, now_i_know_my)// assert typeof now_i_know_my_fuhrer extends { a: number, b: number, c: number, s: readonly [string | 9, "mein", "fuhrer"] }console.debug(now_i_know_my_fuhrer)
similar to recordMap, but made for variable number of function argument parameters.
also see RecordArgsMapper to get an understanding of what
mapping_funcs
is supposed to look like, and how to type it.Example