title: What is the correct way to use the ternary operator with React and Typescript
body: <p>I am currently using this code:</p>
  
  <pre class="lang-js prettyprint-override"><code>      render: props.columnLinks[key]
          ? ((text): ReactElement =&gt; &lt;a href={props.columnLinks[key]}&gt;{text}&lt;/a&gt;)
          : undefined,
  </code></pre>
  
  <p>but I would like to simplify the statement using the <code>&amp;&amp;</code> operator. When I do this however, Typescript throws errors including:</p>
  
  <pre><code>Type 'false' is not assignable to type '((text: any, record: TableDataPoint, index: number) =&gt; ReactNode) | undefined'
  </code></pre>
  
  <p>How is it possible to structure this as you would be able to in JavaScript?</p>