Update Array Object With Spread Operator In Typescript Vs Javascript