title: How to fix the undefined error in typescript and react
body: <p>Hi i have the code like below which calls isSomeFunction method which returns true or false. but in here the argument sometimes can be undefined. so i want to call this function only when selectedItems is not undefined how can i do it.</p>
  <pre><code>&lt;Button
    disabled={
      isSomefunction(assetIds, selectedItems) || //error here 
      isButtonDisabled 
    }/&gt;
  </code></pre>
  <p>i get type undefined is not assignable to type string.</p>
  <p>how can i check if selectedItems is not undefined and then call the isSomeFunction in above case so that i dont get the error.</p>
  <p>could someone help me with this i am new to programming. thanks.</p>
  <hr />