title: type-declaration file for non-module in angular typescript
body: <p>I'm building a website for <a href="https://beakerbrowser.com/" rel="nofollow noreferrer">Beaker Browser</a> using <a href="https://angular.io/" rel="nofollow noreferrer">Angular6</a>.</p>
  
  <p>Beaker Browser has a built-in class called <code>DatArchive</code>. I want to create a type-declaration file for it.</p>
  
  <p>When this class was used in only one file, I simply wrote</p>
  
  <pre><code>declare class DatArchive {
    static selectArchive(opts: any): Promise&lt;DatArchive&gt;;
    static create(opts: any): Promise&lt;DatArchive&gt;;
    constructor(datUrl: String);
    url: string;
  }
  </code></pre>
  
  <p>in the file and everything worked like a charm. However, when I wanted to extract it into its own file, I tried:</p>
  
  <pre><code>export declare class DatArchive {
    static selectArchive(opts: any): Promise&lt;DatArchive&gt;;
    static create(opts: any): Promise&lt;DatArchive&gt;;
    constructor(datUrl: String);
    url: string;
  }
  ...
  // in other files
  import { DatArchive } from 'dat-archive';
  </code></pre>
  
  <p>And although it passed compilation, in runtime, seemingly, it was looking for a <code>DatArchive</code> inside a module, but a <code>DatArchive</code> is a top-level (on <code>window</code> object) class.</p>
  
  <p>So, the question:</p>
  
  <p><strong>In Angular/Typescript, how to write a type-declaration file for a class that is NOT part of a module?</strong></p>