title: Typing the Index Signature of a Module Namespace Object
body: <p>I have a series of related classes packaged up and exported from a single module. Something like:</p>
  
  <pre><code>// states.ts
  
  export {default as Alabama} from "./alabama";
  export {default as Alaska} from "./alaska";
  //...
  </code></pre>
  
  <p>Now, elsewhere in the code, I want to iterate over all the related classes:</p>
  
  <pre><code>import * as States from "./states.ts"
  
  for(let stateExportName in States) {
    let thisStateConstructor = States[stateExportName];
    // ... do something.
  }
  </code></pre>
  
  <p>Hold aside that iteration over a commonjs module's export names would use a for-in (like above), whereas iterating over an es6 module namespace object's exports would use a for-of (since es6 <a href="https://tc39.github.io/ecma262/#sec-@@iterator" rel="nofollow">does define</a> @@iterator on module namespace objects)... in either case, this iteration should be possible.</p>
  
  <p>The problem is that, when I do <code>States[stateExportName]</code>, I get an "Index signature of object type implicitly has an 'any' type." That makes sense, since I haven't defined an index signature for the module anywhere.</p>
  
  <p>My question is: is it possible to define such a signature for ES6 modules in Typescript? If so, how?</p>