title: Angular 5 - Calling functions on the global scope
body: <p>I want to use video.js inside an IonicFramework application I'm building using Angular. I've tried installing it via <code>npm</code> but if I try to import, TypeScript does not recognize any importable module, and I could not locate proper documentation about using it in TS/ES6 applications.</p>
  
  <p>What I did was trying to use it just like any js library. I've included the video.js script in my <code>index.html</code> file:</p>
  
  <pre><code>&lt;script src="assets/js/video_v6_6_3.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I looked inside, and what it does is declare a function called <code>videojs</code> on the global scope (I don't like it - but that's the way it is written).</p>
  
  <p>In my application I try to call this function on the <code>ngAfterViewInit</code> method call, like so: <code>videojs(this.videoId);</code>. But TypeScript throws an exception during run time:</p>
  
  <pre><code>Typescript Error
  Cannot find name 'videojs'.
  </code></pre>
  
  <p>Is there a way to wrap such libraries so they will fit Angular importing? Or maybe have TypeScript accept this kind of methods and not throw an error? I've searched but could not find any information on such scenario.</p>