title: specifying directory for a local .d.ts type file in typescript
body: <p>Over the past few days I have been trying to create a .d.ts for a simple library I found on npm and used in an angular 4 project (<a href="https://stackoverflow.com/questions/49393529/creating-typescript-d-ts-for-third-party-library">creating typescript .d.ts for third-party library</a>). I was able to create such a declaration file, and I thought that the other problem I had, moving the declaration file to a more appropriate directory, would be fairly simple.</p>
  
  <p>While working on the original problem I had simply created the .d.ts declarations file under <code>&lt;root&gt;/node_modules/@types</code> along with the type delcaration files I had downloaded and not created. I had done this because it was fairly clear that my attempts to put the declarations file in another directory were not working, and that seemed a secondary problem. Once I had solved the primary issue I addressed the secondary. I could not find anything to add locations to search for declaration files. I found a setting in <code>tsconfig.json</code> that sounded promising,</p>
  
  <pre><code>"typeRoots": [
    "node_modules/@types",
    "hmm/@types"
  ],
  </code></pre>
  
  <p>here with an experimental value, but the value did not do what it sounded like it ought to do. In fact I could remove all the values in the list and not get any different behavior, including for other type libraries. (I have since found a mention that it is used only to resolve directories for <code>/// &lt;reference=...</code> directives.)</p>
  
  <p>After a great deal of experimentation and some scanning of the <code>tsc</code> code, I stumbled into the realization that if the directory containing additional typescript declarations files included <code>node_modules/@types</code>. tsc would find them and treat them as declaration files. In addition to <code>&lt;root&gt;/npm_modules/@types</code> I created <code>&lt;root&gt;/src/npm_modules/@types</code>, and everything worked as expected. I wasn't happy with the directory name so I tried <code>&lt;root&gt;/src/@types/npm_modules/@types</code>, but that failed.</p>
  
  <p>All my builds were through angular-cli <code>ng</code>, so it's possible <code>ng</code> is secretly creating configuration files that it uses instead of the ones I see, but I don't think that is the case.</p>
  
  <p>Is there any way to configure additional type declaration files for tsc, or to get tsc to recognize certain directories as such? There is a "types" parameter on tsconfig.json, but that seems to mean use <em>only</em> those type files, and I would like to use some type files <em>additionally</em>. Ideally I think I would like a directory structure similar to: <code>&lt;root&gt;/@types/library-package-name</code>. Is this possible?</p>