title: How can I use arrays with object properties in typescript
body: <p>Is there a way to use arrays with object properties without using <code>@ts-ignore</code> in typescript</p>
  <p>Lets say I have this function, it attempts to convert an array to an array with the prop property. This works fine except for the fact that their is a @ts-ignore</p>
  <pre class="lang-js prettyprint-override"><code>    const addPropToArray = &lt;T extends unknown&gt;(x: T[]): T[] &amp; {prop: number} =&gt; {
        //@ts-ignore
        const y: T[] &amp; {prop: number} = [...x];
        y.prop = 3;
        return y
      };
  </code></pre>
  <p>Obviously I can't do this</p>
  <pre class="lang-js prettyprint-override"><code>const x: string[] &amp; {prop:number} = // what could go here
  </code></pre>
  <p>by itself which is why I was thinking of using the function but even then the function must have a <code>@ts-ignore</code>.</p>
  <p>Are arrays with object properties just such a bad idea that typescript doesn't try to support them well, or is their something I'm missing?</p>
  <p>Maybe their is some variation of this that could work?</p>
  <pre class="lang-js prettyprint-override"><code>const x: string[] &amp; {prop:number} = {...[&quot;a&quot;,&quot;b&quot;,&quot;c&quot;], prop: 4}
  </code></pre>
  <p>obviously the problem here is that it isn't an array any more.</p>
  <p>EDIT:
  I realize I could just cast the value instead of using <code>@ts-ignore</code> but that sill doesn't seem like the best solution</p>