title: JSPM + TypeScript + PhotoSwipe : How to successfully import and use the library?
body: <p>I'm trying to use the <a href="http://photoswipe.com/" rel="nofollow">PhotoSwipe</a> library in my JSPM and TypeScript project with no success (I'm bleeding here.. ).</p>
  
  <p>Using a modified version definition file for the PhotoSwipe from <a href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/photoswipe/photoswipe.d.ts" rel="nofollow">DefinitelyTyped</a> (the original didn't work - got "PhotoSwipe not defined"), I came up with this:</p>
  
  <pre><code>declare var PhotoSwipe: PhotoSwipe.IPhotoSwipeStatic;
  declare var PhotoSwipeUI_Default: PhotoSwipeUI_Default.IPhotoSwipeUI_DefaultStatic;
  
  declare module PhotoSwipe {
      ...
      interface IPhotoSwipeStatic {
  
          new &lt;T extends Options&gt; (pswpElement: HTMLElement,
              uiConstructor: (new (pswp: PhotoSwipeInstance&lt;T&gt;, framework: UIFramework) =&gt; UI&lt;T&gt;) | boolean,
              items: PhotoSwipe.Item[],
              options: T): PhotoSwipeInstance&lt;T&gt;;
      }
  }
  
  declare class PhotoSwipeInstance&lt;T extends PhotoSwipe.Options&gt; {
      ...
  }
  
  
  declare module PhotoSwipeUI_Default {
      ...
      interface IPhotoSwipeUI_DefaultStatic {
  
          new (pswp: PhotoSwipeInstance&lt;Options&gt;, framework: PhotoSwipe.UIFramework): PhotoSwipeUI_DefaultInstance;
      }
  }
  
  declare class PhotoSwipeUI_DefaultInstance implements PhotoSwipe.UI&lt;PhotoSwipeUI_Default.Options&gt; {
      ...
  }
  </code></pre>
  
  <p>Trying to import it, I can't seem to figure how to create an instance of PhotoSwipe with:</p>
  
  <p><code>const photoSwipe = new PhotoSwipe(pswpElement, PhotoSwipe.PhotoSwipeUI, items, options);</code></p>
  
  <p>1) </p>
  
  <pre><code>declare module "photoswipe" {
      export = { PhotoSwipe, PhotoSwipeUI_Default };
  }
  </code></pre>
  
  <p>and <code>import "photoswipe";</code> => I get <strong>ReferenceError: PhotoSwipe is not defined</strong></p>
  
  <p>2) </p>
  
  <pre><code>declare module "photoswipe" {
  
      export var PhotoSwipe: PhotoSwipe.IPhotoSwipeStatic;
      export var PhotoSwipeUI_Default: PhotoSwipeUI_Default.IPhotoSwipeUI_DefaultStatic;
  }
  </code></pre>
  
  <p>and <code>import { PhotoSwipe, PhotoSwipeUI_Default } from "photoswipe";
  </code> => I get <strong>TypeError: photoswipe_1.PhotoSwipe is not a constructor</strong></p>
  
  <blockquote>
    <p>Anyone ?</p>
  </blockquote>