A little utility func (js) I use sometimes, and I'd love the typing to work like so:
// original js untypified
function prefixProperties(obj, prefix) {
let out = {};
for (let propt in obj) {
out[prefix + propt] = obj[propt];
}
return out;
}
let x : { num: number, date: Date } = { ... };
let y = prefixProperties(x, 'old');
/*
be great if typeof y was:
{
oldnum: number,
olddate: Date,
};
*/
Or whatever is the most specific is for such a function.
I thought about tuple maps but I guess they don't let you change the name of the key.
{
[K in keyof T]: whatever
};