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.

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)
  • Type Parameters

    • R extends Record<any, readonly any[]>
    • U extends {
          [K in string | number | symbol]: any
      } = {
          [K in string | number | symbol]: unknown
      }
    • D extends unknown = unknown
    • F extends RecordArgsMapper<R, U, D> = RecordArgsMapper<R, U, D>

    Parameters

    • mapping_funcs: F
    • input_args: R

    Returns {
        [K in string | number | symbol]: ReturnType<F[K]>
    }