Want to combine object properties in typescript? Seems like this should do the trick:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | var objectA = { propertyA: 1, propertyB: 2, . . // more properties here . propertyM: 13 }; var objectB = { propertyN: 14, propertyO: 15, . . // more properties here . propertyZ: 26 }; // this is the answer var objectC = {...objectA, ...objectB}; var a = objectC.propertyA; var n = objectC.propertyN; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.