title: How to distribute .d.ts file in npm package
body: <p>I am trying to <a href="https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages" rel="nofollow">include a .d.ts file in my npm package</a> for <a href="https://github.com/StephenCleary/iterjs" rel="nofollow">my (non-TypeScript) library</a>.</p>
  
  <p>I have the following in my <code>package.json</code>:</p>
  
  <pre><code>"typings": "./src/iter.d.ts",
  </code></pre>
  
  <p>But no matter what I put in <code>./src/iter.d.ts</code>, whenever I try to use it in Visual Studio, I always get a "Cannot find module 'iterjs'" message.</p>
  
  <p>To reproduce, create a new TypeScript app in VS (I'm using 2015 with TS 1.8.4), do an <code>npm install iterjs</code>, and add the following to <code>app.ts</code>:</p>
  
  <pre><code>import iter from 'iterjs';
  </code></pre>
  
  <p>I've tried modifying the local copy of <code>iter.d.ts</code> (under <code>node_modules</code>) in a desperate attempt to get <em>anything working at all</em>; my local copy currently has only the following content:</p>
  
  <pre><code>export declare function bob(object: Object, property: string): boolean;
  export default bob;
  </code></pre>
  
  <p>I can verify that Visual Studio is finding and reading the <code>iter.d.ts</code> file (I can see it being read in Process Monitor every time VS opens <code>app.ts</code>); however, there's apprently something in the <code>.d.ts</code> file it doesn't like. I have read about a dozen blog posts, gone through the Handbook, and a half-dozen TypeScript issues on the subject, and have tried about 20 different ways of exporting <em>anything</em> from the <code>.d.ts</code> file, but VS always just gives the same error (Cannot find module 'iterjs').</p>