title: tsd: install local definition file
body: <p>I have a local node package written in TypeScript, which I want to use in my actual project. Using npm, I can install local packages like this:</p>
  
  <pre><code>$ npm install --save /path/to/package
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>$ npm install --save /path/to/package.tar.gz
  </code></pre>
  
  <p>This installs the required .js files in the node_modules directory. There's also a generated .d.ts file within that package, which I'd like to install to my project (automatically linking it in typings/tsd.d.ts). But using the following command has no effect:</p>
  
  <pre><code>$ tsd install /path/to/package/package.d.ts --save
  </code></pre>
  
  <p>It says <code>&gt;&gt; zero results</code>. So, what is the way to install local definition files without the need of a repository?</p>
  
  <p>UPDATE:</p>
  
  <p>I can simply copy my d.ts file into the typings directory and my text editor (for me it's Sublime Text with the TypeScript plugin) it's able to find the declaration. The directory layout is something like this:</p>
  
  <pre><code>/my-project/
    /typings/
      tsd.d.ts - auto-generated by `tsd install`
      node/ - I've installed the node definitions
      my-package.d.ts - copied or symlinked file
    my-project.ts - I'm working here
  </code></pre>
  
  <p>However I've got an issue when exporting the only function in <code>module.exports</code> (<code>exports = function...</code> in TypeScript). In this case, the exported function is kinda 'anonymous' and isn't even named in the d.ts file, so I need to edit it manually.</p>
  
  <p>My test case:</p>
  
  <p>'my-package' provides a single function, usually imported as 'myPackage':</p>
  
  <pre class="lang-ts prettyprint-override"><code>export = function myPackage(a: string, b: string) { return a + ' ' + b; };
  </code></pre>
  
  <p><code>declaration</code> is set to <code>true</code> in tsconfig.json, so the <code>tsc</code> command generated a my-package.d.ts file:</p>
  
  <pre><code>declare var _default: (a: string, b: string) =&gt; string;
  export = _default;
  </code></pre>
  
  <p>My package is supposed to be used like this in my project:</p>
  
  <pre><code>import myPackage = require('my-package');
  myPackage('foo', 'bar');
  </code></pre>
  
  <p>However, tsc can't find <code>myPackage</code>, even though <code>my-package.d.ts</code> was copied into the typings folder. I need to edit that file so it looks like this:</p>
  
  <pre><code>declare var myPackage: (a: string, b: string) =&gt; string;
  //export = _default; - not needed
  </code></pre>
  
  <p>Or even better for a correct functioning <code>require()</code>:</p>
  
  <pre><code>declare module 'my-package' /* this is the string passed to require() */ {
      export = function(a: string, b: string): string;
  }
  </code></pre>