title: Convention for Structuring Angular Interface Files and User Defined Type Guards
body: <p>I am using Interfaces in my Angular 2 project, and also have created User Defined Type Guards:</p>
  
  <h2>grid-metadata.ts</h2>
  
  <pre><code>export interface GridMetadata {
    activity: string;
    createdAt: object;
    totalReps: number;
    updatedAt: object;
  }
  </code></pre>
  
  <h2>grid.service.ts</h2>
  
  <pre><code>...
      function isGridMetadata(obj: any): obj is GridMetadata {
        [ 'activity', 'createdAt', 'totalReps', 'updatedAt' ].every((prop) =&gt; {
          if (obj.hasOwnProperty(prop) === false) return false;
        });
  
        return typeof obj.activity === 'string' &amp;&amp;
          obj.createdAt.hasOwnProperty('.sv') &amp;&amp;
          obj.createdAt['.sv'] === 'timestamp' &amp;&amp;
          typeof obj.totalReps === 'number' &amp;&amp;
          obj.updatedAt.hasOwnProperty('.sv') &amp;&amp;
          obj.updatedAt['.sv'] === 'timestamp' ?
            true :
            false;
      }
  ...
  </code></pre>
  
  <p>What is the convention for storing (i.e. in a file structure) Interfaces; should they be in their own files or in an <code>interface</code> or <code>util</code> directory or file, for example?</p>
  
  <p>What is the convention for storing shared User Defined Type Guards? Would it make sense to have the Interface and UDTG in the same file (as they are related) or have all UDTGs in a shared module?</p>
  
  <p>I can't find any solid examples as to the best practice or commonly accepted conventions when structuring my project. </p>