title: How to import the jwt-decode type definition into Typescript (Ionic 2)
body: <p>Just when I think I have the Typings in Typescript under control I come across something that proves the opposite.</p>
  
  <p>This time I am trying to use the <a href="https://github.com/auth0/jwt-decode" rel="noreferrer">jwt-decode</a>. I have installed the type definition via the command <code>typings i dt~jwt-decode --save</code></p>
  
  <p>Two problems</p>
  
  <p><strong>1.</strong> When I look into the <code>index.d.ts</code> I see the following</p>
  
  <pre><code>    declare module 'jwt-decode' {
          namespace JwtDecode {
          interface JwtDecodeStatic {
              (token: string): any;
          }
      }
  
      var jwtDecode: JwtDecode.JwtDecodeStatic;
      export = jwtDecode;
      export as namespace jwt_decode;
      }
  </code></pre>
  
  <p>The IDE (VS Code) is displaying an error <em>"[ts] Global module exports may only appear at top level"</em> under the last  line <code>export as namespace jwt_decode;</code></p>
  
  <p><strong>2.</strong> How do I import this?</p>
  
  <p>I try the import statement..</p>
  
  <pre><code>   import { ??  } from 'jwt-decode';
  </code></pre>
  
  <p>but I can't see anything to import.</p>
  
  <p>None of the other (many) examples I can find seem to help. It must be simple, I just don't know the syntax.</p>
  
  <p>Thanks in advance for any help.</p>
  
  <p>[UPDATE]
  After some more reading, it looks like typings has been superseded by just using npm..</p>
  
  <p>So I tried</p>
  
  <pre><code>npm install --save jwt-decode
  npm install --save @types/jwt-decode
  
  // and import via
  import * as JWT from 'jwt-decode';
  </code></pre>
  
  <p>But still can't get it to import correctly.</p>
  
  <p>[UPDATE2]
  I can add the statement <code>let t = jwt-decode("aaa");</code> and see the signature, but have the following IDE error</p>
  
  <p><code>[ts] 'jwt_decode' refers to a UMD global, but the current file is a module. Consider adding an import instead.</code></p>