title: Using a type as a value in typescript
body: <p>I'm using <code>inject-loader</code> to mock dependencies for a Typescript project being unit tested.  The service I'm testing has an import line like this:</p>
  
  <pre><code>import pnp, { SearchQuery, Sort, SortDirection, CamlQuery } from "sp-pnp-js";
  </code></pre>
  
  <p>For my test, I want to mock several of the functions on pnp, but keep the classes intact.  In my unit test file, I've included this import:</p>
  
  <pre><code>import { SearchQuery, Sort, SortDirection, CamlQuery } from "sp-pnp-js";
  </code></pre>
  
  <p>Which gives my test access to the necessary classes.  I've declared a mock service object:</p>
  
  <pre><code>// mock services
  const mockPnp = {
      default: { ... }
  };
  </code></pre>
  
  <p>Which I'm wiring into my target class instance:</p>
  
  <pre><code>Service = require("inject!./sharepointservice")({
      "sp-pnp-js": mockPnp
  }).Service;
  </code></pre>
  
  <p>And everything works, so long as I don't run any code that references those classes (ie. <code>SearchQuery</code>).  To get that to work, I tried adding it to the mock:</p>
  
  <pre><code>// mock services
  const mockPnp = {
      default: { ... },
      SearchQuery: SearchQuery
  };
  </code></pre>
  
  <p>However, I get a <code>'SearchQuery' only refers to a type, but is being used as a value here</code> error.</p>
  
  <p>I've tried casting to <code>any</code> (same error), tricks with modules and exports, with no luck.  I'm supposed to be able to write any Javascript with Typescript, and this would work trivially in Javascript - what am I missing here?</p>