title: Import class in definition file (*d.ts)
body: <p>I want to extend Express Session typings to allow use my custom data in session storage. I have an object <code>req.session.user</code> which is an instance of my class <code>User</code>:</p>
  
  <pre><code>export class User {
      public login: string;
      public hashedPassword: string;
  
      constructor(login?: string, password?: string) {
          this.login = login || "" ;
          this.hashedPassword = password ? UserHelper.hashPassword(password) : "";
      }
  }
  </code></pre>
  
  <p>So i created my <code>own.d.ts</code> file to merge definition with existing express session typings:</p>
  
  <pre><code>import { User } from "./models/user";
  
  declare module Express {
      export interface Session {
          user: User;
      }
  }
  </code></pre>
  
  <p>But it's not working at all - VS Code and tsc don't see it. So I created test definition with simple type:</p>
  
  <pre><code>declare module Express {
      export interface Session {
          test: string;
      }
  }
  </code></pre>
  
  <p>And the test field is working ok, so the import cause problem.</p>
  
  <p>I also tried to add <code>/// &lt;reference path='models/user.ts'/&gt;</code> instead import but the tsc didn't see the User class - how can I use my own class in *d.ts file?</p>
  
  <p><strong>EDIT:</strong>
  I set tsc to generate definition files on compile and now I have my user.d.ts:</p>
  
  <pre><code>export declare class User {
      login: string;
      hashedPassword: string;
      constructor();
      constructor(login: string, password: string);
  }
  </code></pre>
  
  <p>And the own typing file for extending Express Sesion:</p>
  
  <pre><code>import { User } from "./models/user";
  declare module Express {
      export interface Session {
          user: User;
          uuid: string;
      }
  }
  </code></pre>
  
  <p>But still not working when import statement on top. Any ideas?</p>