I am failing to understand what the parentheses are doing in the map array method
type EmployedPerson = (Person & Employee);
function correlateData(peopleData: Person[], staff: Employee[]): EmployedPerson[]
{
const defaults = { company: "MISSING", dept: "MISSING" };
return peopleData.map(p =>
( { ...p, ...staff.find(empl => p.id === empl.id) || { id: p.id, ...defaults }} )
);
}
It seems like I can't just return a literal object without wrapping it inside parentheses. From the theoretical point of view, what are the parentheses doing/what role do they have?