title: ko is undefined when using KnockoutJS with TypeScript and RequireJS
body: <p>I'm learning <a href="/questions/tagged/typescript" class="post-tag" title="show questions tagged &#39;typescript&#39;" rel="tag">typescript</a> and having some issues defining a <a href="/questions/tagged/knockoutjs" class="post-tag" title="show questions tagged &#39;knockoutjs&#39;" rel="tag">knockoutjs</a> view model and have the bindings work.</p>
  
  <p>Below is the view mode:</p>
  
  <pre><code>module MyApp {
      export class MyViewModel {
          public clicked: KnockoutObservable&lt;boolean&gt;;
  
          constructor() {
              this.clicked = ko.observable(false);
          }
  
          myClickEvent() {
              this.clicked(true);
          }
      }
  }
  </code></pre>
  
  <p>(The constructor may not be required.)</p>
  
  <p>And here is how I'm using requirejs to load the modules:</p>
  
  <pre><code>require.config({
  baseUrl: "../../Scripts",
      paths: {
          knockout: "knockout-3.1.0",
          jquery: "jquery-2.1.1.min"
      }
  });
  
  require(['knockout', 'jquery', 'myviewmodel'], (ko, $, myViewModel) =&gt; {
      $(document).ready(() =&gt; {
          var vm = new MyApp.MyViewModel();
          ko.applyBindings(vm, document.getElementById("profile-bar"));
      });
  });
  </code></pre>
  
  <p>The problem is when the following line:</p>
  
  <pre><code>this.clicked = ko.observable(false);
  </code></pre>
  
  <p>When the click event fires (seems to be binding to the HTML elemement OK), the following error occurs in the browser:</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: ko is not defined</p>
  </blockquote>
  
  <p>In previous attempts I'd used</p>
  
  <pre><code>define('myviewmodel', ['ko'], (ko) =&gt; {
  </code></pre>
  
  <p>etc to ensure the requirement was satisfied but using that approach I cannot see how to use the module and export a class to be used as a <a href="/questions/tagged/knockoutjs" class="post-tag" title="show questions tagged &#39;knockoutjs&#39;" rel="tag">knockoutjs</a> view model.</p>
  
  <p>Do you have any advice on what I've done wrong?</p>
  
  <p>Thank you.</p>