title: "Object is possibly undefined" in React and TypeScript
body: <pre><code>certificate?: any;
  
  &lt;S.Contents&gt;{certificate[0]}&lt;/S.Contents&gt;
  &lt;S.Contents&gt;{certificate[1]}&lt;/S.Contents&gt;
  &lt;S.Contents&gt;{certificate[3]}&lt;/S.Contents&gt;
  </code></pre>
  <p>If the type of props is set to any and used as an index of an array, it works well. But if you change that any type to Array, Generic type'Array' requires 1 type argument(s). I get an error like this.</p>
  <p>When I print typeof to the console, the object comes out, so when I change it from Array to object, I get an error other. &quot;Object is possibly 'undefined'.&quot;</p>
  <pre><code>setCertificate(res.data.qualification.certificate);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/yY40D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yY40D.png" alt="enter image description here" /></a></p>
  <p>Since it is an original array, I tried to create elements by turning it into map, but it also didn't work with a map is not a function error. I don't know what to do with me. Help.</p>