title: Typescript: declaring typings on a file level, not a data structure
body: <p>I don't believe this is possible with Typescript but thought I'd ask anyway.</p>
  
  <p>I'm trying to enforce a particular arrangement of <em>exports</em> from a TS file. It's for a plugin-based script where plugins may or may not export certain functionality, but they <em>must</em> export certain other things. I'd like to type the <em>exports</em> from a single file within each bundle.</p>
  
  <p>I realize I could group everything into a single data structure within the plugins and type that, but by doing that I'd lose the benefits of tree shaking in my bundling tool.</p>
  
  <p>Here's an example.</p>
  
  <p>Say my plugins:</p>
  
  <ul>
  <li><em>must</em> export a <code>generate</code> function (which for the sake of illustration could be massive - several MBs)</li>
  <li><em>must</em> export a <code>config</code> object of a particular type, which defines metadata about the plugin. </li>
  <li>can <em>optionally</em> export a <code>getOtherInfo</code> function.</li>
  <li>any other exports are invalid. </li>
  </ul>
  
  <p>I can type this easily by grouping it all into an object &amp; typing that, but then any time I want to import just the <code>config</code> object, I end up getting the massive <code>generate</code> method - which I don't want in my bundle. </p>
  
  <p>But I don't see a way to declare typings on the file-level like I need. Any ideas? </p>