title: Calling push() on array, TypeError: Attempted to assign to readonly property
body: <p>Working in React Native. I'm trying to declare an array and then push things to said array, but I'm getting the error <code>TypeError: Attempted to assign to readonly property</code></p>
  <p><strong>CONTEXT:</strong></p>
  <p>The app prints via a thermal printer.</p>
  <ol>
  <li>The <code>print</code> method receives an array of commands</li>
  </ol>
  <p>Example:</p>
  <pre><code>print([{appendText: &quot;blah&quot;}, {
    appendCutPaper: StarPRNT.CutPaperAction.PartialCutWithFeed,
  }]
  </code></pre>
  <ol start="2">
  <li>The <code>print</code> method is asynchronous and if you attempt to call the method again before the last call has finished, it errors.</li>
  <li>Because of #2, we created a queue system that accepts a job (array of commands) and then works through the jobs synchronously.</li>
  </ol>
  <p>In a React component, I'm attempting to create a job by declaring an empty array named <code>printJob</code>
  and then pushing various commands to it. In this case, we take a snapshot of a View and then push the commands returned by the <code>printImage</code> method to the <code>printJob</code> array.</p>
  <pre><code>onClick={() =&gt; {
    const printJob = []
    viewShot.current
      .capture()
      .then((uri) =&gt; {
        printJob.push(...printImage(uri))
      })
      .catch((err) =&gt; alert(err))
  
    newPrintJob(printJob)
  }
  </code></pre>
  <p><code>printImage</code> returns the array of commands to print an image and cut the paper:</p>
  <pre><code>const CUT_PAPER = {
    appendCutPaper: StarPRNT.CutPaperAction.PartialCutWithFeed,
  }
  
  export function printImage(uri) {
    return [{ appendBitmap: uri }, CUT_PAPER]
  }
  </code></pre>
  <p>So the goal is to generate the array of commands and pass that to the queue as a job. Now, I could just do <code>newPrintJob(printImage(uri))</code> in the above case, which works completely fine. However, there is a particular setting the user can configure where it will need to print multiple images, one per ticket (in other words, multiple <code>printImage</code>s). I want to consider all of that one job, hence the need to create the printJob array.</p>
  <p><strong>THE PROBLEM:</strong>
  I'm getting an error <code>TypeError: Attempted to assign to readonly property</code> which seems to be triggered by <code>printJob.push(...printImage(uri))</code>. If I comment that line out, the error doesn't get thrown.</p>
  <p>I don't understand why this would happen because you can call push on an array, even if it's declared as a constant. I also tried declaring it with <code>var</code> and <code>let</code> and still received the same error.</p>
  <p>I hope I've provided enough context here. LMK if I need to add more.</p>
  <p><strong>Additional info:</strong></p>
  <pre><code>&quot;react&quot;: &quot;16.13.1&quot;
  &quot;react-native&quot;: &quot;~0.63.3&quot;
  </code></pre>