I've been working on creating a signature for this particular function:
export function objToArray(obj){
let result = [];
for(const prop of Object.keys(obj)){
result.push(Object.assign({objProp: prop.toString()}, obj[prop]));
}
return result;
}
In the case of an object of type T that holds values of type U, my goal is to generate
Array<U & {objKey: string}>
. I'm struggling with how to achieve this using TypeScript.