title: How to import other type definitions in my custom type definition files
body: <p>I'm creating a TypeScript library for React and need to create custom type definitions ( <code>index.d.ts</code> ).</p>
  
  <p>In generally, developers do not need to import type definitions for some libraries explicitly and all they need to do is installing <code>@types/</code> packages in latest TypeScript.</p>
  
  <p>My library is depending on React and its type definitions ( <code>@types/react</code> ) and I want to import React type definitions in custom type definitions ( <code>index.d.ts</code> ) like the following.</p>
  
  <pre><code>// index.d.ts
  /// &lt;reference types="node" /&gt;
  import { HtmlHTMLAttributes } from "@types/react";
  
  declare module "*.bar" {
    const value: HtmlHTMLAttributes;
    export default value;
  }
  </code></pre>
  
  <p>But the definitions do not work fine and throw error "Cannot find module".</p>
  
  <p>I have two questions,</p>
  
  <ol>
  <li>Which is correct, to install <code>@types/react</code> as "dependencies", or to do as "devDependencies"?</li>
  <li>How to import other type definitions in my custom type definitions and use them?</li>
  </ol>
  
  <hr>
  
  <p><strong>EDITED</strong></p>
  
  <p>I use import syntax <code>from "react"</code> instead of <code>from "@types/react"</code>, then when I write the following code, it throws error <code>Cannot find  module 'foo.bar'.</code> .</p>
  
  <pre><code>// sample.ts
  import * as Foo from "foo.bar";
                       ^^^^^^^^^
  </code></pre>
  
  <p>But removing import syntax from the definition, it does not throw errors.</p>
  
  <pre><code>// index.d.ts
  /// &lt;reference types="node" /&gt;
  // import { HtmlHTMLAttributes } from "react"; &lt;-- Remove
  declare module "*.bar" {
  ...
  
  // sample.ts
  import * as Foo from "foo.bar"; // &lt;-- does not throw errors.
  </code></pre>
  
  <p>This library is depending on type definitions of React, but does not need to include React, so I do not install <code>react</code> .</p>
  
  <pre><code>// package.json
  ...
  dependencies: {},
  devDependencies: {
    "@types/react": "^16.4.9"
  },
  ...
  </code></pre>
  
  <p>What should I do?</p>