title: Define classes without using the class keyword in typescript
body: <p>I'm a TypeScript newbie and the following is a question of curiosity mostly.</p>
  
  <p>Before ES6, JavaScript had no classes. Thus, I would expect to be able to get away with not using in TypeScript as well.</p>
  
  <p>Yet, I don't find the right way of doing it. Take this sample class:</p>
  
  <pre><code>class FooConcrete {
      getImpl : () =&gt; number;
  
      constructor(getImpl: () =&gt; number) {
          this.getImpl = getImpl;
      }
  
      get() : number {
          return this.getImpl();
      }
  }
  </code></pre>
  
  <p>Since type definition files usually expose something like the following, I start with that:</p>
  
  <pre><code>interface FooConcrete
  {
      get() : number;
  }
  
  interface FooConcreteStatic
  {
      new () : FooConcrete;
  }
  </code></pre>
  
  <p>But how do I then define the constructor function <code>FooConcrete</code>?</p>
  
  <p>I tried:</p>
  
  <pre><code>var FooConcrete : FooConcreteStatic = function FooConcrete() {
      return {
          get: () =&gt; 42
      };
  };
  </code></pre>
  
  <p>That doesn't compile though, although the corresponding Javascript works as intended:</p>
  
  <pre><code>new FooConcrete().get() // =&gt; 42
  </code></pre>
  
  <p>Is there a way to declare <code>FooConcrete</code> as <code>FooConcreteStatic</code> without writing it as a class?</p>
  
  <p>(The motivation behind the case was that I was curious to see if there was a way to get rid of the spurious redirection in the class from the prototype's <code>get</code> to the implementation <code>getImpl</code> - in this case there's no need for a <code>get</code> in a prototype.)</p>