title: Why is Array.isArray always returning false here?
body: <p>I'm trying to cast form data to a custom type, but I'm having trouble getting it to recognize an array in the custom type. I saw this method begin used in another similar problem, but it isn't working for me. Is there another way of doing this?</p>
  <p>I need to detect the array type as using <code>value as string</code> splits the string character by character instead of putting the string to the first index. I can't use <code>.push()</code> either, because it doesn't know if <code>object[key]</code> is an array or not.</p>
  <p>Simplified version of the custom type:</p>
  <pre><code>export type CustomType = {
      id: number;
      name: string;
      items: string[];
      [key: string]: (string | string[] | number)
  }
  </code></pre>
  <p>Here is the code:</p>
  <pre><code>const form = document.getElementById(&quot;form&quot;) as HTMLFormElement;
  const data = new FormData(form);
  
  const object = {} as CustomType;
  data.forEach((value, key)=&gt; {
      if(Array.isArray(object[key])) {                 // &lt;---- Always false
          const arr = value.toString().split(&quot;,&quot;);
          object[key] = arr;
      }
      else {
          object[key] = value as string;
      }
  });
  </code></pre>