Home

Published

- 1 min read

merge properties of object typescript

img of merge properties of object typescript

The solution for this is noted below

merge properties of object typescript

Solution

   const target = { a: 1, b: 2 }
const source = { b: 4, c: 5 }
// Copies source to target object without changing
// target object instance
const returnedTarget = Object.assign(target, source)

Try other methods by searching on the site. That is if this doesn’t work