title: Typescript Get type of "import * as whatIsMyType from './foo';"
body: <p>My <code>foo.ts</code> exports several functions with same signature e.g. <code>(a: number): number</code>.</p>
  
  <p>In my main.ts, I do</p>
  
  <pre><code>import * as foo from './foo';
  // foo.myFunction1 and foo.myFunction2 are defined
  
  export const resultsFor = (a: number) =&gt; {
    return Object.keys(foo).reduce(
        (result, currentKey) =&gt; {
          result[currentKey] = foo[currentKey](a);
          return result;
        },
        {} as {[index:string]: number}
      );
  }
  </code></pre>
  
  <p>Now the type of <code>resultFor</code> is <code>(a: number): {[index:string]: number}</code>, but that's slightly too generic.</p>
  
  <p>I wish <code>resultFor</code>'s type to be</p>
  
  <pre><code>(a: number): {myFunction1: number, myFunction2: number, /* and other exports from 'foo.ts': number */}
  </code></pre>