title: What's the proper way to setup a "pure" typescript module
body: <p>I'm trying to build a private module that I know will only be used by another TypeScript project.  </p>
  
  <p>According to this (<a href="https://github.com/Microsoft/TypeScript/issues/5225" rel="noreferrer">https://github.com/Microsoft/TypeScript/issues/5225</a>) I should be able to simply import my other project without needing to build type definitions.</p>
  
  <p>The problem is I'm missing the type definitions for any dependencies on that library when I try to import it.</p>
  
  <p>Here's the situation:</p>
  
  <p>Lets say you have two projects.  <code>lib</code> and <code>app</code>.  <code>app</code> imports <code>lib</code>, a pure TypeScript node module.</p>
  
  <pre>
  ├── app/
  │   ├── dist/
  │   │   ├── index.d.ts
  │   │   ├── index.js
  │   │   └── index.js.map
  │   ├── src/
  │   │   └── index.ts
  │   ├── package.json
  │   ├── package-lock.json
  │   └── tsconfig.json
  └── lib/
      ├── src/
      │   └── index.ts
      ├── package.json
      ├── package-lock.json
      └── tsconfig.json
  
  </pre>
  
  <p><code>app</code> simply imports a function from <code>lib</code> and runs it:</p>
  
  <pre><code>import lib from "lib";
  
  lib("test");
  </code></pre>
  
  <p>Lib imports a dependency and its types, and exports a function:</p>
  
  <p><code>package.json</code>:</p>
  
  <pre class="lang-json prettyprint-override"><code>"dependencies": {
    "dotenv": "^6.1.0"
  },
  "devDependencies": {
    "@types/dotenv": "^4.0.3",
    "typescript": "^3.1.6"
  }
  </code></pre>
  
  <p><code>app/src/index.ts</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>import dotenv from "dotenv";
  
  dotenv.load()
  
  export default (message: string) =&gt; {
      console.log(message);
  }
  </code></pre>
  
  <p>When I try to build <code>app</code> I get an error about the missing type definitions from the the <code>lib</code> dependency:</p>
  
  <pre>
  node_modules/lib/src/index.ts:1:20 - error TS7016: Could not find a declaration file for module 'dotenv'. 'lib/node_modules/dotenv/lib/main.js' implicitly has an 'any' type.
    Try `npm install @types/dotenv` if it exists or add a new declaration (.d.ts) file containing `declare module 'dotenv';`
  
  1 import dotenv from "dotenv";
  </pre>
  
  <p>What's the proper way to handle this scenario?  It'll work fine in a mixed JS / TS module, because the "compile boundary" will end at the imported module and its exposed types, but since this module is "pure" TypeScript, it'll crawl all of its dependencies as if it were one large repo.</p>
  
  <p>What's the proper way to set this up?  Or is the real issue that <code>npm install</code> doesn't install the dev dependencies?  Should I install all of the <code>@types</code> as prod dependencies?</p>