var nodeRefMap = {};
function addNodeRef(key: String, item: Object){
console.log("Before:");
console.log(nodeRefMap);
nodeRefMap = Object.assign({key: item}, nodeRefMap);
console.log("After:");
console.log(nodeRefMap);
}
addNodeRef("123",{});
addNodeRef("345",{});
I am encountering an issue while trying to add a new parameter using the function above in Typescript. The problem lies in setting up the key of the object. The desired output should be:
{
"123": {},
"345": {},
}
However, the current result is:
{
"key": {},
}
What modifications do I need to apply in order to achieve the expected outcome?