📅  最后修改于: 2022-03-11 14:48:20.946000             🧑  作者: Mango
// For every properties K of type T, transform it to U
function mapObject(obj: Record, f: (x: T) => U): Record
const names = { foo: "hello", bar: "world", baz: "bye" };
const lengths = mapObject(names, s => s.length); // { foo: number, bar: number, baz: number }