title: How to provide types to for static class members
body: <p>I have a set of classes that all should have some common properties and type restraints.</p>
  <p>Think of how <code>Uint8Array</code> and <code>Uint16Array</code> are similar.</p>
  <p>The first thing that might come to mind for comparing them could be:</p>
  <pre><code>interface TypedArray {
      static of(...args: number[]): TypedArray;
      static from(args: IterableIterator&lt;number&gt;): TypedArray;
      [index: number]: number;
  }
  
  class Uint8Array implements TypedArray {
      ...
  }
  
  class Uint16Array implements TypedArray {
      ...
  }
  </code></pre>
  <p>I thought that a generic interface would've described what I wanted, but static members aren't allowed in interfaces.</p>
  <p>The question <a href="https://stackoverflow.com/questions/13955157/how-to-define-static-property-in-typescript-interface">How to define static property in TypeScript interface</a> is somewhat similar to this, but none of the provided solutions worked for what I'm doing, and I don't particularly care if the solution uses an interface.</p>
  <p>Any situation that makes all of the classes more generic than they have to be, won't fit my use.</p>
  <p>Consider the following situation, where I want the most specific types possible:</p>
  <pre><code>interface X {
      // static prop(): number;
      foo?(): void;
      bar?(): void;
  }
  
  class Y implements X {
      static prop() { return 2; }
      foo() {};
      // bar: undefined
  }
  
  new Y().foo(); // okay
  
  class Z implements X {
      static prop() { return 4; }
       // foo: undefined
      bar() {};
  }
  
  new Z().foo(); // error
  </code></pre>
  <p>In contrast, if I were to do something like this:</p>
  <pre><code>interface I {
      prop?(): void;
  }
  
  const C: I = class {
      static prop() {}
  }
  </code></pre>
  <p>I would now have lost information about the actual class, since, in reality, it <em>does</em> have the <code>prop</code> method.</p>
  <p>But that doesn't address the static properties of the classes, how can I provide a type for both?</p>
  <p>Furthermore, my classes extend from other classes, so abstract classes won't fit here.</p>