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 fuhrer_mapper: RecordArgsMapper<typeof now_i_know_my, { s: [string | 9, ...any[]] }, number> = {
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]
}
this is analogous to RecordMapper, except now, we deal with variable number of argument parameters instead of just one.
as a compromise,
R
now has to containArray
s as its entry values.