The spread operator is kinda cool.

this.results = [ ...this.results, ...data.results];

The spread operator allows you to easily place an expanded version of an array into another array.

You can read about spread operator here.

Answer from Amsakanna on Stack Overflow
๐ŸŒ
DEV Community
dev.to โ€บ fullstackchris โ€บ advanced-typescript-a-generic-function-to-merge-object-arrays-18ja
Advanced TypeScript: A Generic Function to Merge Object Arrays - DEV Community
December 9, 2021 - You could explicitly write key / value assignments for the keys that you want to update... or you can leverage JavaScript's built in Object.assign function and TypeScript's generic capabilities to only write one such function for all merging actions you need across your entire app! ๐Ÿ˜„ ยท For example, in ReduxPlate, I have two types, IFile, and IEditorSettings: ... IEditorSettings extends IFile and has just one additional property: isActive. When visitors click the "Generate!" button on the MVP page, the response from the server returns an array of objects of type IFile instead of IEditorSettings, since the server is not concerned with the isActive property.
๐ŸŒ
SPGuides
spguides.com โ€บ typescript-array-concatenation
TypeScript Merge Arrays | TypeScript Merge Two Arrays Of Objects
June 29, 2025 - To merge two arrays of objects in TypeScript, you can use the spread operator (...) for a simple concatenation. If you need to ensure uniqueness based on a specific property, use a Map to filter out duplicates.
Discussions

Combine objects in an array of objects in Typescript?
EDIT: maybe the question was not too good to understand. Hope this helps: Array(134) means there are 134 Objects inside. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Help with handling JSON array of objects (merge two arrays)
Split things up a bit and type your objects to make the logic easier to follow (this is off the top of my head, may not be 100% correct): interface Pipe { OD: number; SCH: {SCH40: number; SCH80: number}; Area?: number; // I think? } const getArea = (pipe: Pipe, sch: 'SCH40' | 'SCH80') => { return }; // Add an 'Area' property to each 'Pipe' object const pipesWithArea: Pipe[] = this.Pipesizes.map(x => ({...x, Area: getArea(x, this.selectedSCH)})); return pipesWithArea.find(x => x.Area >= this.OutsideNumber); More on reddit.com
๐ŸŒ r/typescript
14
14
June 19, 2020
Merge multiple objects inside the same array into one object
161 How to concatenate properties from multiple JavaScript objects ยท 36 How to convert an array of objects to object with key value pairs More on stackoverflow.com
๐ŸŒ stackoverflow.com
Is there a benefit to using lodash.merge (or other utilities of the same feature) versus merging via object destructuring?
Yes, absolutely. Lodash merge recursively merges properties at every level. If you merged two objects with destructuring (or lodash.assign or Object.assign which are equivalent), it drops anything that is not top-level from the first object. See: https://lodash.com/docs#merge More on reddit.com
๐ŸŒ r/node
13
4
November 14, 2022
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ typescript-merge-arrays
How to merge Arrays in TypeScript | bobbyhadz
February 28, 2024 - Use the spread syntax to merge arrays in TypeScript. The spread syntax will unpack the values of the arrays into a new array.
๐ŸŒ
Medium
daimmughals.medium.com โ€บ merging-arrays-in-typescript-d8bc5803c096
Merging Arrays in TypeScript. Have you ever come across a problemโ€ฆ | by Daim | Medium
August 20, 2023 - Use the spread operator to merge arrays in TypeScript. The spread operator syntax will unpack the values of the arrays into a new array.
๐ŸŒ
Upmostly
upmostly.com โ€บ home โ€บ typescript โ€บ merging arrays without duplicates
Merging Arrays Without Duplicates in TypeScript - Upmostly
November 8, 2022 - In the above example, TypeScript compares the values, so the result is true. Comparing objects, however, even though theyโ€™re identical, obj1 and obj2 are not equal, because theyโ€™re referring to different objects. If we copy the value of obj2 into obj3 then these are considered the same, since they both refer to obj2. We can fix this by comparing the objects by value: function merge<T>(arr1: T[], arr2: T[]) { return [ ...arr1, ...arr2.filter((item1) => { arr1.some((item2) => isDeepStrictEqual(item1, item2)); }), ]; }
๐ŸŒ
Tim Mousk
timmousk.com โ€บ blog โ€บ typescript-merge-objects
How To Merge Objects In TypeScript? โ€“ Tim Mouskhelichvili
March 27, 2023 - typescriptconst obj1 = { name: 'Tim' }; const obj2 = { role: 'Admin' }; const merged = Object.assign({}, obj1, obj2); // Outputs: { "name": "Tim", "role": "Admin" } console.log(merged); The Lodash merge function is great when you want to merge ...
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ typescript-array-concat-method
TypeScript Array concat() Method - GeeksforGeeks
July 19, 2024 - The TypeScript Array.concat() method merges two or more arrays into a new array. It takes multiple arrays and/or values as parameters and returns a single array containing all the elements.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ typescript โ€บ typescript_array_concat.htm
TypeScript - Array concat()
concat() method returns a new array comprised of this array joined with two or more arrays. valueN โˆ’ Arrays and/or values to concatenate to the resulting array. Returns a new array.
๐ŸŒ
JavaScript in Plain English
javascript.plainenglish.io โ€บ advanced-typescript-a-generic-function-to-merge-object-arrays-cb0bd9a5c382
Advanced TypeScript: A Generic Function to Merge Object Arrays | by Chris Frewin | JavaScript in Plain English
June 14, 2021 - You could explicitly write key/value assignments for the keys that you want to updateโ€ฆ or you can leverage JavaScriptโ€™s built-in Object.assign function and TypeScript's generic capabilities to only write one such function for all merging actions you need across your entire app! ๐Ÿ˜„ ยท For example, in ReduxPlate, I have two types, IFile, and IEditorSettings: Join Medium for free to get updates from this writer. ... IEditorSettings extends IFile and has just one additional property: isActive. When visitors click the "Generate!" button on the MVP page, the response from the server returns an array of objects of type IFile instead of IEditorSettings, since the server is not concerned with the isActive property.
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-merge-array-of-objects-by-key
How to Merge Arrays of Objects by Key in TypeScript
In this blog post, we will explore different methods to achieve this in TypeScript. One way to merge arrays of objects by key in TypeScript is by using the reduce and map functions.
๐ŸŒ
Reddit
reddit.com โ€บ r/typescript โ€บ help with handling json array of objects (merge two arrays)
r/typescript on Reddit: Help with handling JSON array of objects (merge two arrays)
June 19, 2020 -

I have a json array of Objects and need to pick a corresponding object in that array according to some calculations.

My json have a following structure: {"OD": number, "SCH" {"SCH40": number, "SCH80": number}}

I need to do some math with OD and SCH numbers, compare it with an outside number and find corresponding value for OD key.

I can get a new array (of numbers I compare the outside number with):

this.Pipeareas = this.Pipesizes.map (x => Math.pow((x.OD - 2 * x.SCH[this.selectedSCH])/2000,2) * Math.PI);

How to merge existing and new arrays?

I tried (this add extra existing array and new object to new array (not key:value pair))

this.Pipeareas = {...this.Pipesizes, Area: this.Pipesizes.map (x => Math.pow((x.OD - 2 * x.SCH[this.selectedSCH])/2000,2) * Math.PI) }

and (this adds new key "Area" to each object but the value is full array, not corresponding numbers from new array)

this.Pipesizes.map (x => x.Area = this.Pipesizes.map (x => Math.pow((x.OD - 2 * x.SCH[this.selectedSCH])/2000,2) * Math.PI))

The result should be like:

return this.Pipeareas.find(x => x >= this.OutsideNumber);

๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ Array โ€บ concat
Array.prototype.concat() - JavaScript - MDN Web Docs
The concat() method of Array instances is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array.
๐ŸŒ
Medium
rapidfork.medium.com โ€บ merge-arrays-or-arrays-of-objects-in-javascript-tyepscript-1f7c4e83a94a
Merge Arrays or Arrays of Objects in JavaScript/TyepScript | by RapidFork Technology | Medium
May 19, 2024 - For merging objects into a single object with simple key-value pairs. const arrayOfObjects = [ { a: 1, b: 2 }, { b: 3, c: 4 }, { d: 5 } ];
๐ŸŒ
SamanthaMing
samanthaming.com โ€บ tidbits โ€บ 49-2-ways-to-merge-arrays
2 Ways to Merge Arrays in JavaScript | SamanthaMing.com
Or just write less code and use concat and be done with ๐Ÿ˜‚ ... So here's the quick rule. If you know you're dealing with arrays, use spread. But if you might be dealing with the possibility with a non-array, then use concat to merge an array ๐Ÿ‘
๐ŸŒ
Omarileon
omarileon.me โ€บ blog โ€บ typescript-merge-objects
mari. | 3 Simple Ways to Merge Objects in TypeScript
January 26, 2024 - Instead of a merging all of the ... So to sum things up, to merge objects in TypeScript, you can use either the spread syntax, Lodash's merge function, or Object.assign....
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-join-two-or-more-arrays-in-typescript-using-concat
How to join two or more arrays in TypeScript using concat()
In TypeScript, we can join two or more arrays using the concat() method. We can join two, three, or more arrays using this method. ... The concat() method returns a new array with all the elements of the joined arrays.
๐ŸŒ
DEV Community
dev.to โ€บ svehla โ€บ typescript-how-to-deep-merge-170c
How to deep merge in Typescript - DEV Community
October 5, 2021 - This generic finds all nonshared keys between object T and U and makes them optional thanks to Partial<> generic provided by Typescript. This type with Optional keys is merged via & an operator with the object that contains all T and U shared keys which values are of type T[K] | U[K].