title: Typescript IOC in case of node
body: <p>I am wondering how would you use typescript IOC specifically node app.</p>
  
  <p>In case of <a href="https://www.stevefenton.co.uk/2015/05/stop-mixing-typescript-internal-and-external-modules/" rel="nofollow">external module-based architecture</a> there is no any classes in the app. Just pure modules because my app heavily depends on node_modules.</p>
  
  <p>How would I integrate IOC solution in such case? Any thoughts?</p>
  
  <p>Here is my specific case I want to use IOC for:</p>
  
  <p>I have mongoose model:</p>
  
  <pre><code>interface IStuffModel extends IStuff, mongoose.Document { }   
  
  var Stuff= mongoose.model&lt;IStuffModel&gt;('Stuff', Schemas.stuffSchema);
  
  export = Stuff;
  </code></pre>
  
  <p>And related fake class:</p>
  
  <pre><code>export class Stuff implements IStuff { 
   //do stuff
  }
  </code></pre>