<p dir="auto">Apologies if this is a duplicate of an existing issue, but I haven't been able to find an answer to this specific issue. I note however <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="69690167" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/2839" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/2839/hovercard" href="https://github.com/microsoft/TypeScript/issues/2839">#2839</a></p>
<p dir="auto">A summary of the config/setup for our app:</p>
<ul dir="auto">
<li>TypeScript <code class="notranslate">v1.7.0-dev.20150827</code></li>
<li><code class="notranslate">tsd v0.6.4-beta</code></li>
<li><code class="notranslate">tsconfig.json</code>:</li>
</ul>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;compilerOptions&quot;: {
    &quot;target&quot;: &quot;es5&quot;,
    &quot;module&quot;: &quot;system&quot;,
    &quot;declaration&quot;: false,
    &quot;noImplicitAny&quot;: true,
    &quot;removeComments&quot;: false,
    &quot;noLib&quot;: false,
    &quot;sourceMap&quot;: true,
    &quot;jsx&quot;: &quot;react&quot;
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"compilerOptions"</span>: {
    <span class="pl-ent">"target"</span>: <span class="pl-s"><span class="pl-pds">"</span>es5<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"module"</span>: <span class="pl-s"><span class="pl-pds">"</span>system<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"declaration"</span>: <span class="pl-c1">false</span>,
    <span class="pl-ent">"noImplicitAny"</span>: <span class="pl-c1">true</span>,
    <span class="pl-ent">"removeComments"</span>: <span class="pl-c1">false</span>,
    <span class="pl-ent">"noLib"</span>: <span class="pl-c1">false</span>,
    <span class="pl-ent">"sourceMap"</span>: <span class="pl-c1">true</span>,
    <span class="pl-ent">"jsx"</span>: <span class="pl-s"><span class="pl-pds">"</span>react<span class="pl-pds">"</span></span>
  }
}</pre></div>
<p dir="auto">Our app depends on <a href="https://github.com/borisyankov/DefinitelyTyped/blob/master/bootstrap-slider/bootstrap-slider.d.ts"><code class="notranslate">bootstrap-slider</code></a>; as you can see this type definition does not define a module. Instead it 'extends' <a href="https://github.com/borisyankov/DefinitelyTyped/blob/master/jquery/jquery.d.ts"><code class="notranslate">jquery</code></a> in what I understand is the usual way for JQuery components. Via <code class="notranslate">tsd</code> our app defines a <code class="notranslate">tsd.d.ts</code> file that references the <code class="notranslate">bootstrap-slider</code> and <code class="notranslate">jquery</code> type definitions, amongst others.</p>
<p dir="auto">Now consider a <code class="notranslate">.tsx</code> file where we define a React component that wraps <code class="notranslate">bootstrap-slider</code>. This <code class="notranslate">.tsx</code> file references the <code class="notranslate">tsd.d.ts</code> definition.</p>
<p dir="auto"><code class="notranslate">jquery</code> <a href="https://github.com/borisyankov/DefinitelyTyped/blob/1d6c126e8ead25892ded5a32df2e813ffad06905/jquery/jquery.d.ts#L3178">declares <code class="notranslate">$</code></a>, hence there is no need to import <code class="notranslate">jquery</code>. Nor is there a need to import <code class="notranslate">bootstrap-slider</code> from a typing perspective because we will reference everything we need via <code class="notranslate">jquery</code>'s <code class="notranslate">$</code> (indeed to try and do so would fail because there is no module by the name of <code class="notranslate">"bootstrap-slider"</code> defined)</p>
<p dir="auto">However, this now presents a problem because nowhere in our application are we declaring via an import a dependency on <code class="notranslate">bootstrap-slider</code>. The generated code (target ES5, module SystemJS) does not include a reference to <code class="notranslate">bootstrap-slider</code> and hence the relevant JS files are not loaded at runtime.</p>
<p dir="auto">What is the recommended solution in this situation?<br>
Should the <code class="notranslate">bootstrap-slider</code> type definition include a module definition for exactly this reason?<br>
Or are we missing a more obvious solution?</p>
<p dir="auto">Thanks</p>
<p dir="auto">In a <code class="notranslate">.d.ts</code> file, I have the following:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import * as interfaces from './interfaces';

declare module sequelize {
  export import Promise = interfaces.Promise;
}
declare var sequelize: interfaces.Static;

export = sequelize;"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-c1">*</span> <span class="pl-k">as</span> <span class="pl-s1">interfaces</span> <span class="pl-k">from</span> <span class="pl-s">'./interfaces'</span><span class="pl-kos">;</span>

<span class="pl-k">declare</span> module <span class="pl-s1">sequelize</span> <span class="pl-kos">{</span>
  <span class="pl-k">export</span> <span class="pl-k">import</span> <span class="pl-smi">Promise</span> <span class="pl-c1">=</span> <span class="pl-s1">interfaces</span><span class="pl-kos">.</span><span class="pl-smi">Promise</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">declare</span> <span class="pl-k">var</span> <span class="pl-s1">sequelize</span>: <span class="pl-s1">interfaces</span><span class="pl-kos">.</span><span class="pl-smi">Static</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-c1">=</span> <span class="pl-s1">sequelize</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">I'm getting an error saying "duplicate identifier 'sequelize'".<br>
I think this might not be the best way of doing things, but I couldn't find any other way.<br>
What I want to achieve is exporting the <code class="notranslate">sequelize</code> variable using <code class="notranslate">export =</code> syntax while also exporting some interfaces using <code class="notranslate">declare module</code>.</p>
<p dir="auto">If I do this instead it works fine:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import * as interfaces from './interfaces';

declare module sequelize {
  type Promise&lt;T&gt; = interfaces.Promise&lt;T&gt;;
}
declare var sequelize: interfaces.Static;

export = sequelize;"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-c1">*</span> <span class="pl-k">as</span> <span class="pl-s1">interfaces</span> <span class="pl-k">from</span> <span class="pl-s">'./interfaces'</span><span class="pl-kos">;</span>

<span class="pl-k">declare</span> module <span class="pl-s1">sequelize</span> <span class="pl-kos">{</span>
  <span class="pl-k">type</span> <span class="pl-smi">Promise</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-c1">=</span> <span class="pl-s1">interfaces</span><span class="pl-kos">.</span><span class="pl-smi">Promise</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">declare</span> <span class="pl-k">var</span> <span class="pl-s1">sequelize</span>: <span class="pl-s1">interfaces</span><span class="pl-kos">.</span><span class="pl-smi">Static</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-c1">=</span> <span class="pl-s1">sequelize</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">but I don't want to use types because you cannot extend a type. another option is:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import * as interfaces from './interfaces';

declare module sequelize {
  interface Promise&lt;T&gt; extends interfaces.Promise&lt;T&gt; {}
}
declare var sequelize: interfaces.Static;

export = sequelize;"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-c1">*</span> <span class="pl-k">as</span> <span class="pl-s1">interfaces</span> <span class="pl-k">from</span> <span class="pl-s">'./interfaces'</span><span class="pl-kos">;</span>

<span class="pl-k">declare</span> module <span class="pl-s1">sequelize</span> <span class="pl-kos">{</span>
  <span class="pl-k">interface</span> <span class="pl-smi">Promise</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-k">extends</span> <span class="pl-s1">interfaces</span><span class="pl-kos">.</span><span class="pl-smi">Promise</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-kos">}</span>
<span class="pl-k">declare</span> <span class="pl-k">var</span> <span class="pl-s1">sequelize</span>: <span class="pl-s1">interfaces</span><span class="pl-kos">.</span><span class="pl-smi">Static</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-c1">=</span> <span class="pl-s1">sequelize</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">which works fine but is very confusing. Is there a better way to achieve this?<br>
On a side note, it's very confusing to me how there are two types of modules. The one with <code class="notranslate">export</code>s and the one that's a namespace.<br>
A better title for this issue is probably <em>cannot re-export interfaces in <code class="notranslate">declare module</code> without switching its type to object</em></p>