<p dir="auto">I'm currently writing a webserver application using hapijs (nodejs). I have a bunch of plugins which I want to write in Typescript. A Hapijs plugin needs a function called <code class="notranslate">register()</code> and an attributes function property with a name and version:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="register(server, options, next) {
}
register.attributes = {
    name: 'plugin',
    version: '0.1.0'
};"><pre class="notranslate"><span class="pl-en">register</span><span class="pl-kos">(</span><span class="pl-s1">server</span><span class="pl-kos">,</span> <span class="pl-s1">options</span><span class="pl-kos">,</span> <span class="pl-s1">next</span><span class="pl-kos">)</span><span class="pl-kos"></span> <span class="pl-kos">{</span>
<span class="pl-kos">}</span>
<span class="pl-s1">register</span><span class="pl-kos">.</span><span class="pl-c1">attributes</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">name</span>: <span class="pl-s">'plugin'</span><span class="pl-kos">,</span>
    <span class="pl-c1">version</span>: <span class="pl-s">'0.1.0'</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">When I want to compile this code, I always get</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="lib/plugins/plugin.ts(2,5): 2300 Duplicate identifier 'register'.
lib/plugins/plugin.ts(8,12): 2300 Duplicate identifier 'register'."><pre class="notranslate"><code class="notranslate">lib/plugins/plugin.ts(2,5): 2300 Duplicate identifier 'register'.
lib/plugins/plugin.ts(8,12): 2300 Duplicate identifier 'register'.
</code></pre></div>
<p dir="auto">I don't know the specs very well but I'm wondering whether it should be allowed or not?<br>
Edit: <a href="http://hapijs.com/api#plugins" rel="nofollow">hapijs plugin docs</a></p>
<p dir="auto">This used to be on codeplex and I cannot find a reference here.</p>
<p dir="auto"><a href="https://typescript.codeplex.com/workitem/917" rel="nofollow">https://typescript.codeplex.com/workitem/917</a></p>
<p dir="auto">The problem is that I have project.d.ts and lets say that it has a Point class with simple {x,y} properties.</p>
<p dir="auto">project-plugin-coolvector.d.ts might come along tomorrow, and that Plugin JS might add a z property to the existing Point class.</p>
<p dir="auto">If project-plugin-coolvector.d.ts attempts to export a Point class with a z property. You get a duplicate error.  I looked at the JQuery plugins example on DT but project.d.ts must contain classes, since Point has a constructor.</p>
<p dir="auto">I see no way of being able to support the direction of the project in this instance.</p>