title: How do I reference a type declared in a Type Script .d.ts file generated by tsc's declaration property
body: <p>Big picture: my organisation has several applications written in TypeScript, each of which contain a lot of duplicated code. We have started down a path of packaging our reusable TypeScript code as NPM packages and publishing them to the private NPM registry in TFS 2017. We are using Webpack to compile the reusable TypeScript code to JavaScript and using the <code>declarations</code> property in <code>tsconfig.json</code> to force a <code>.d.ts</code> file to be generated. This works, and the <code>.d.ts</code> file is included alongside the JavaScript output in the NPM package which gets installed in the client app. However, referencing the types within it in the consuming application doesn't work unless I put a reference to the <code>.d.ts</code> file directly in the consuming application, which I'd like to avoid.</p>
  
  <p>We are using TypeScript 2.8+ with the <code>@types</code> method for accessing third party typings, so for example with Jquery I have <code>"@types/Jquery":</code>  in the <code>package.json</code> file - that causes <code>node_modules\@types\jquery\index.d.ts</code> to come into existence, and Visual Studio Code seems to magically discover that file provide strong type checking.</p>
  
  <p>It doesn't however magically discover my own Typings file which is located at <code>node_modules\my-package\dist\my-package.d.ts</code>. However, if I add this to a TypeScript file:</p>
  
  <pre><code>/// &lt;reference path="../../../node_modules/my-package/dist/my-package.d.ts" /&gt;
  </code></pre>
  
  <p>Then I can reference the types defined in the file. However, this is not a great solution as it means every consuming application needs to know the path within the <code>node_modules</code> folder to every custom Typings file I have created. Presumably this is what the <code>@types</code> syntax was supposed to help avoid.</p>
  
  <p>Is there a way to make the consuming project discover custom typings files that are contained within an NPM package?.</p>