title: Shorthand get textContent if querySelector doesn't return null
body: <p>I was try trying to find a shorthand way to do something like this</p>
  
  <pre><code>let text = el.querySelector('.some-class').textContent || ''
  </code></pre>
  
  <p>However the above gives an error:</p>
  
  <blockquote>
    <p>Object is possibly 'null'.</p>
  </blockquote>
  
  <p>So I randomly decided to try this, and I get no errors any more. However, I don't know what it is doing or if it is doing what I want it to do.</p>
  
  <pre><code>let text = el.querySelector('.some-class')!.textContent || ''
  </code></pre>
  
  <p>Basically I am looking for a way to trigger the <code>textContent</code> part if an element is found otherwise trigger the part after the <code>||</code>.</p>
  
  <p>I am not sure what the expression I just wrote is, so I don't really know what to Google here.</p>
  
  <p>What I think it is saying is <strong>to not evaluate the expression with a null result</strong> like when defining a type:</p>
  
  <pre><code>public value!: string
  </code></pre>
  
  <p>If I am correct is there a proper way to do what I would like?</p>