title: Import svg.js with plugins in Angular
body: <p>I have difficulties importing svg.js with it's <a href="http://svgjs.com/plugins/" rel="nofollow noreferrer">plugins</a> using typescript in an Angular 5 project.</p>
  
  <p>With npm I installed:</p>
  
  <ul>
  <li><p>svg.js </p></li>
  <li><p><a href="https://github.com/svgdotjs/svg.draggable.js" rel="nofollow noreferrer">svg.draggable.js</a></p></li>
  </ul>
  
  <p>In ticket.component.ts:
  Imported svg.js as Svg type and this way I can draw a rectangle, this code works:</p>
  
  <pre><code>import * as Svg from 'svg.js'
  ...
  export class TicketComponent implements OnInit {
  
    ngOnInit() {
      let draw = Svg('ticket-svg').size(1000, 500);
      let rect = draw.rect(800, 300).attr({fill: '#fff', stroke: '#000', 'stroke-width': 1});
    }
  ...
  }
  </code></pre>
  
  <p>But I cannot use functions from the svg.draggable plugin, because it's not imported:</p>
  
  <pre><code>rect.draggable()
  // TS2339: Property 'draggable' does not exist on type 'Rect'.
  </code></pre>
  
  <p>I want something like this:</p>
  
  <pre><code>import * as Svg from {'svg.js', 'svg.draggable.js', 'svg.whatever.js'}
  </code></pre>
  
  <p>In the GitHub example code of svg.draggable.js they just add these two lines in the html and that's all:</p>
  
  <pre><code>&lt;script src="svg.js"&gt;&lt;/script&gt;
  &lt;script src="svg.draggable.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>In angular with typescript, this is completely different because I need the import in the ticket.component.ts file, not in the html.</p>
  
  <p>So how to import svg.js with multiple plugins from node_modules as Svg type?</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>I read a recommendation to import the typings for these 3rd party js libraries, so I installed: </p>
  
  <pre><code>"@types/svg.js": "^2.3.1",
  "@types/svgjs.draggable": "0.0.30"
  </code></pre>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Tried to merge the two js file into one file and import the merged version, but for some reason this hacky way does not work either...</p>
  
  <p>Thanks in advance!</p>