title: Restrict typescript class methods implementing interface
body: <p>Currently if I create a class that implements an interface, the class created will all methods not included in the interface. Here's an example:</p>
  
  <pre><code>interface ExampleTypes {
    alpha();
  }
  
  class Example implements ExampleTypes {
    alpha () {
      return true
    }
    beta () {
      return true
    }
  }
  </code></pre>
  
  <p>I am looking for a way to restrict the methods a given class can have.</p>
  
  <p>This is something I also tried:</p>
  
  <pre><code>class ExampleSource {
    alpha () {
      return true
    }
  }
  
  class Example implements Partial&lt;ExampleSource&gt; {
    alpha () {
      return true
    }
    beta () {
      return true
    }
  }
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>class ExampleSource {
    alpha () {
      return true
    }
  }
  
  class Example implements ExampleSource {
    alpha () {
      return true
    }
    beta () {
      return true
    }
  }
  </code></pre>
  
  <p>Which is unintuitive. I'd like <code>beta</code> to not be allowed in <code>Example</code>. </p>
  
  <p>This is the functionality that works but using a function and not a class:</p>
  
  <pre><code>interface ExampleType {
    alpha?();
    beta?();
  }
  </code></pre>
  
  <p>This is value:</p>
  
  <pre><code>function Example(): ExampleType {
    return {
      alpha: () =&gt; true,
    };
  }
  </code></pre>
  
  <p>This throws a typescript error:</p>
  
  <pre><code>function Example(): ExampleType {
    return {
      alpha: () =&gt; true,
      meow: () =&gt; true,
    };
  }
  </code></pre>
  
  <p>Ideally I can have this same functionality but with classes.</p>