const now_i_know_my = { a: 1, b: 2, c: 3, s: "nein" }
const now_i_know_my_greek = recordMap({
a: (v) => `${v}-alpha`,
b: (v) => `${v}-beta`,
c: (v) => `${v}-theta`,
s: (v) => 9
}, now_i_know_my)
// assert typeof now_i_know_my_greek extends { a: string, b: string, c: string, s: number }
console.debug(now_i_know_my_greek) // { a: "1-alpha", b: "2-beta", c: "theta", s: 9 }
Generated using TypeDoc
applies the function
mapping_funcs[K]
to inputinput_data[K]
, for every keyK in mapping_funcs
see RecordMapper to get an understanding of what
mapping_funcs
is supposed to look like, and how to type it.moreover, the 3 generic parameters (
R
,U
,D
) used here are the same as the ones at RecordMapper, so check it out.