title: Using static functions in generics for TypeORM Active record
body: <p>I am stuck with this: I have a set of functions that Read an entity from the database using the Active record functions, and filter them in a very specific way. Like for example (this is an overly simplified example, but the minimal that can reproduce the error; in real life a complex set of filters are applied to the entity)</p>
  <p>Lets say that I want to get all the entities using a function</p>
  <pre><code>async function getUser() : Promise&lt;User[]&gt; {
      return await User.find(); // in real life there is a complex filter here
  }
  </code></pre>
  <p>and then another one</p>
  <pre><code>async function getCompany() : Promise&lt;Company[]&gt; {
      return await Company.find(); // in real life there is a complex filter here
  }
  </code></pre>
  <p>So I tried writing a generic but this did not work</p>
  <pre><code>async function getEntity&lt;Type extends BaseEntity&gt;(type: Type) : Promise&lt;Type[]&gt; {
      return await Type.find();
  }
  </code></pre>
  <p>I get proper autocompletion from the IDE telling me that Type has a function .find() because Type extends BaseEntity, but I get the error <code>'Type' only refers to a type, but is being used as a value here.ts(2693)</code></p>
  <p>I've researched the error and it appears in different contexts, like mixing values with classes. But I am clearly refering to the class here, as is the &quot;User&quot; class the one who has the find method (not any instance; its a static method)</p>
  <p>Please Help me I'm stuck</p>