title: ES6 typescript import all exported constants as an array
body: <p>I'm trying to export many constants that I can later import and map through as an array.
  I can't put them all in one object and export them, because I'm using generics (OptionInterface) and I wish to keep the type validations.</p>
  
  <p>Currently, I export each object as a named export and then export all as an array. The problem is that another developer might not know he must add a new element to the exported array.</p>
  
  <p>An example:</p>
  
  <pre><code>//ElemSettings.tsx
  export interface ElemProps&lt;OptionInterface = any&gt; {
    title: string,
    key: string,
    options: OptionsInterface[] 
  
  export interface SpecialOption {
   s1: string,
   s2: number
  }
  
  
  //Elements.tsx - what I wish to export
  export const elemOne: ElemProps {
    title: 'element One',
    key: elemOne'
    options: [1,2,3]
  }
  
  export const elemTwo: ElemProps {
    title: 'element Two',
    key: elemTwo'
    options: [1,2,3]
  }
  
  export const elemThree: ElemProps&lt;SpecialOption&gt; {
    title: 'element Two',
    key: elemTwo'
    options: [{s1:'one',s2:1},{s1:'two',s2:2}]
  }
  
  //This is how I export now
  export const elems: Array&lt;ElemProps&gt; =
    [elemOne, elemTwo, elemThree]
  
  
  
  //user.tsx
  import { elems } from 'Elements';
  
  const doSomething = () =&gt; { 
        elems.map(...)
  }
  </code></pre>
  
  <p>If I try to remove the exported array and just import all the elements, e.g:</p>
  
  <pre><code>import * as elems from 'Elements';
  </code></pre>
  
  <p>and then use it as in doSomething, I get an error:</p>
  
  <pre><code>Property 'map' does not exist on type 'typeof import("Elements")'.
  </code></pre>
  
  <p>Any ideas how can I achieve exporting all constants as an array but keep the typing as well?</p>