title: Typescript Union Types: Dealing with Interfaces
body: <p>What's the proper way to handle a situation where you have two interfaces that are similar enough that you want to run them through the same piece of logic:</p>
  
  <pre><code>interface DescriptionItem {
      Description: string;
      Code: string;
  }
  interface NamedItem {
      Name: string;
      Code: string;
  }
  
  function MyLogic(i: DescriptionItem | NamedItem) {
      var desc = (&lt;DescriptionItem&gt;i).Description || (&lt;NamedItem&gt;i).Name;
  
      return i.Code + ' - ' + desc;
  }
  </code></pre>
  
  <p>This works; however, my question is on improving the <code>var desc = ...</code> line.  Is what I have above the best option?  Or is there a better way to handle this situation in Typescript?</p>