title: X only refers to a type, but is being used as a value here as function parameter
body: <p>I have a loader function that exports an abstract class by the name of &quot;Item&quot;. I then have a function that loads each instance of the item from a given directory, however to make sure that the loaded item is an <code>instanceof</code> the Item I want to load, then I need to get the <code>typeof</code> item I am loading in the loader method.</p>
  <p>However by using  generics for the <code>load</code> method, I get the following error: <code>'Instance' only refers to a type, but is being used as a value here.</code>
  <br/><br/>This is my loader class and Item:</p>
  <pre class="lang-js prettyprint-override"><code>export abstract class Item {
      // ... Different Item properties E.G Name
  }
  
  // Type for a collection of items or array
  export type ItemCollection&lt;Instance extends Item&gt; =
      | Collection&lt;string, Instance&gt;
      | Instance[];
  
  export class Loader {
      public async loadItems&lt;Instance extends Item&gt;(
          collection: ItemCollection&lt;Instance&gt;,
          item: typeof Instance, // &lt; 'Instance' only refers to a type, but is being used as a value here.
          dirs: string[]
      ) {
          // ... Load Items and check if it is instanceof &quot;Instance&quot;, then assign value to the ItemCollection
      }
  }
  </code></pre>
  <p>Is there a way to get the <code>typeof</code> the <code>Instance</code> as a parameter, so I can check if the loaded items are an instance of it?</p>