title: React Typescript and inline if statements to establish type
body: <p>My aim is to display a component when data is available.</p>
  
  <p>The data is regularly fetched from an API by the parent component and stored in state. It is then passed as a 'data' prop to the child component.</p>
  
  <p>The works well if a placeholder of the valid type is defined in state at the constructor stage.</p>
  
  <p>But when it is not possible to include a placeholder of the valid type I run into issues. </p>
  
  <p>If I include the following in render still get Type Error.</p>
  
  <pre><code>{typeof this.state.tracker !== 'undefined' ? &lt;Tracker data={this.state.tracker} /&gt; : ''}
  </code></pre>
  
  <p>TypeScript error: Type 'TrackerInterface | undefined' is not assignable to type 'TrackerInterface'.</p>
  
  <p>It is my understanding that TypeScript knows when a type is excluded by an if statement.</p>
  
  <p>Your guidance is much appreciated.</p>