title: How to upload image as file in React with TypeScript
body: <p>I'm trying to upload image as file but I'm not sure how to do it exactly.</p>
  <p>Here is my input:</p>
  <pre><code>&lt;input type=&quot;file&quot; name=&quot;image&quot; placeholder='Image' onChange={e =&gt; handleSetImage(e, i)}/&gt;
  </code></pre>
  <p>Here is the error for &quot;e&quot;:</p>
  <blockquote>
  <p>Argument of type 'ChangeEvent' is not assignable to
  parameter of type 'FileList'.   Type 'ChangeEvent'
  is missing the following properties from type 'FileList': length,
  item, [Symbol.iterator]ts(2345)</p>
  </blockquote>
  <p>And here is my handler:</p>
  <pre><code>const [colorsAndImages, setColorsAndImages] = useState&lt;[{image: object, color: string}]&gt;([{image: {}, color: ''}])
  
  ...
  
      const handleSetImage = (event: FileList, index: number) =&gt; {
              const files = event;
              const list = [...colorsAndImages]
              list[index][image] = list
              console.log(list);
          };
  </code></pre>