title: writing clean code: find an property in object-array with null-check
body: <p>I want to write clean-code. I have this react-code (typescript 3.6.4):</p>
  
  <pre><code>&lt;Button color="primary"
      size="large"
      disabled={props.user.objectArray.find((element)=&gt; {
                  return element.primaryKey === state.findPrimaryKey
              }).isClosed}
      onClick={doSomething}&gt;
  Download information
  </code></pre>
  
  <p></p>
  
  <p>Now I get the message, that the return value could be "undefined". Understandable, maybe the primaryKey could not be found in the object array.</p>
  
  <p>I could write a function which checks first for null, but could this be fixed anyhow without a function?</p>
  
  <pre><code>function getBooleanValue() {
      let booleanCheck = false;
      const temp = props.user.objectArray.find((element) =&gt; {
          return element.primaryKey === state.findPrimaryKey
      });
      if (typeof temp !== "undefined") {
          booleanCheck = temp.siteClosed;
      }
      return booleanCheck;
  }
  </code></pre>
  
  <p>How can I write a clean code to get my boolean value?</p>