You can use a mix of .map and the ... spread operator

You can set the value after you've created your new array

let array = [{id:1,name:'One'}, {id:2, name:'Two'}, {id:3, name: 'Three'}];

let array2 = array.map(a => {return {...a}})

array2.find(a => a.id == 2).name = "Not Two";

console.log(array);
console.log(array2);
.as-console-wrapper { max-height: 100% !important; top: 0; }

Or you can do it in the .map

let array = [{id:1,name:'One'}, {id:2, name:'Two'}, {id:3, name: 'Three'}];

let array2 = array.map(a => {
  var returnValue = {...a};

  if (a.id == 2) {
    returnValue.name = "Not Two";
  }

  return returnValue
})


console.log(array);
console.log(array2);
.as-console-wrapper { max-height: 100% !important; top: 0; }

Answer from George on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Spread_syntax
Spread syntax (...) - JavaScript - MDN Web Docs - Mozilla
May 22, 2026 - The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value ...
🌐
Medium
cleverzone.medium.com › demystifying-javascript-spread-operat-71924c888a8
Demystifying JavaScript : Spread operator (…) | by Abhijeet Kumar | Medium
August 26, 2023 - In this article, we will explore ... denoted by three dots (...), allows JavaScript developers to easily split array elements or object properties and spread them into a new array or object....
Discussions

Update Array containing objects using spread operator
I want to close to a new array keeping existing object as is. ... Why not just read the docs? If you read it you'll see that it's impossible what you want. Spread operator isn't intended for such array modification. I would suggest you to use Underscore/Lodash library instead. ... I see, do you have an example of ... More on stackoverflow.com
🌐 stackoverflow.com
javascript - Spread an array of objects into a parent object
Is there a simple way to use the spread ... operator to combine an array of objects with a another object to create a single object? This example shows what I'm trying to accomplish: const More on stackoverflow.com
🌐 stackoverflow.com
Using spread operator on array of object to access elements
I've seen this post Use spread operator on objects array? which is quite similar but they do not try to access elements. So is it possible to use spread operator on array of object to access elements ? More on stackoverflow.com
🌐 stackoverflow.com
Spread operator with array and object
The spread operator only copies enumerable own properties of objects, but typescript copies all properties of the object into the receiving type. So in your example, if t = [1, 2, 3], at runtime c = {'0': 1, '1': 2, '2': 3}, but typescript infers the type of c as containing map and all the other methods on an array object, which happens to be assignable to the array type. Typescript does not distinguish between enumerable and non-enumerable properties, so I'm not sure there's a way for the compiler to catch this. But unit tests would catch this! More on reddit.com
🌐 r/typescript
14
8
April 27, 2022
🌐
W3Schools
w3schools.com › react › react_es6_spread.asp
React ES6 Spread Operator
The JavaScript spread operator (...) copies all or part of an existing array or object into another array or object.
🌐
SamanthaMing
samanthaming.com › tidbits › 92-6-use-cases-of-spread-with-array
6 Use Case of Spread with Array in JavaScript | SamanthaMing.com
MDN: Spread syntax allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places ...
🌐
Appsmith
community.appsmith.com › content › guide › javascript-spread-operator-what-are-those-three-dots-my-code
The Javascript Spread Operator - What Are Those Three Dots in My Code? | Appsmith Community Portal
August 29, 2023 - This seemingly simple syntax holds incredible potential, transforming the way we approach various coding scenarios. To spread the elements of one array into another, you simply use the spread operator followed by the array you want to spread.
🌐
SitePoint
sitepoint.com › blog › javascript › quick tip: how to use the spread operator in javascript
Quick Tip: How to Use the Spread Operator in JavaScript — SitePoint
November 7, 2024 - The spread operator is used to split up array elements or object properties. It allows an iterable such as an array expression or string to be expanded in places where zero or more arguments or elements are expected.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-spread-operator
JavaScript Spread Operator - GeeksforGeeks
The spread operator (...) in JavaScript provides a simple and expressive way to expand elements from arrays, strings, or objects. It helps make code cleaner by reducing the need for manual copying or looping.
Published   January 16, 2026
🌐
Medium
medium.com › @muesingb › spread-operator-examples-using-arrays-and-objects-579af5581743
Spread Operator Examples using Arrays and Objects | by Muesingb | Medium
April 19, 2020 - With the spread operator, it instead creates a copy of what you’re referencing and allocates new memory for it. One case where it’s valuable to copy instead of directly mutating data is when using state in React. Note that copying only goes one level deep, it does not copy nested arrays and objects...
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript array methods › javascript spread operator
The Practical Usages of JavaScript Spread Operator
May 8, 2024 - ES6 provides a new operator called spread operator that consists of three dots (...). The spread operator allows you to spread out elements of an iterable object such as an array, map, or set.
🌐
GPTWebHelper
blixtdev.com › how-to-use-the-spread-operator-in-javascript
How to Use The Spread Operator in JavaScript
December 20, 2022 - Simply put, the spread operator in JavaScript expands or unpacks the elements of an array or iterable object.
🌐
Medium
medium.com › front-end-weekly › spread-operator-and-destructuring-arrays-and-objects-in-javascript-2f5578e1252b
Spread Operator and Destructuring arrays and objects in JavaScript | by Raunaq Sachdev | Frontend Weekly | Medium
November 9, 2018 - It is used to split an array into a list of comma-separated values which can be used in various places such as function arguments or array matching(which we’ll cover next). ... This operator is very useful in real world scenarios; for eg., ...
🌐
GitBook
basarat.gitbook.io › typescript › future-javascript › spread-operator
Spread Operator | TypeScript Deep Dive
December 31, 2019 - The main objective of the spread operator is to spread the elements of an array or object.
🌐
Medium
medium.com › coding-at-dawn › how-to-use-the-spread-operator-in-javascript-b9e4a8b06fab
How to use the spread operator (…) in JavaScript
November 19, 2020 - “When ...arr is used in the function call, it ‘expands’ an iterable object arr into the list of arguments.” — JavaScript.info · The spread operator was added to JavaScript in ES6 (ES2015), just like the rest parameters, which have the same syntax: three magic dots ….
🌐
Reddit
reddit.com › r/typescript › spread operator with array and object
r/typescript on Reddit: Spread operator with array and object
April 27, 2022 -

Edit: This seems to be an issue since 2016, and apparently, no fix (yet? since 2016) because it seems like just an edge case.

Hi all, I accidentally mistyped [ with { at line 4 in the code below and it passes compiler check. Should this happen and why does it behave like that?

        type Foo = number // just an example
        
        let t: Foo[] = [] // [1,2,3] 
        let c: Foo[] = {...t}
        console.log(c.map(e=>-e))

It took me a few minutes in a sea of code to realise what's wrong. Needless to say, it was quite frustrating, I'm sorry if this is a stupid question.

playground link

here is my tsconfig.json

        {
          "compilerOptions": {
            "target": "es5",
            "lib": [
              "dom",
              "dom.iterable",
🌐
Kinsta®
kinsta.com › home › resource center › blog › javascript tutorials › unleashing the power of javascript spread operator
Unleashing the Power of JavaScript Spread Operator - Kinsta®
October 1, 2025 - The spread operator in JavaScript is a syntax introduced in ECMAScript 6 (ES6) that allows you to spread the elements of an iterable (such as arrays, strings, or objects), into another iterable or function call.
🌐
DEV Community
dev.to › marinamosti › understanding-the-spread-operator-in-javascript-485j
Understanding the Spread Operator in JavaScript - DEV Community
September 23, 2019 - Spread syntax allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-spread-operator-works-in-js
How Spread Operator Works in JS - GeeksforGeeks
July 23, 2025 - The spread operator (...) in JavaScript is a powerful feature used to expand or spread elements of an iterable (like an array or object) into individual elements.