<p dir="auto">Duplicate some <code class="notranslate">addEventListener</code> signature in XMLHttpRequest interface. <code class="notranslate">onxxx</code> props are not, but <code class="notranslate">addEventListener</code> methods are duplicate. At least, this is inconsistent coding.</p>
<p dir="auto">actual:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// lib.d.ts
interface XMLHttpRequestEventTarget {
    onabort: (ev: Event) =&gt; any;
    onerror: (ev: Event) =&gt; any;
    onload: (ev: Event) =&gt; any;
    onloadend: (ev: ProgressEvent) =&gt; any;
    onloadstart: (ev: Event) =&gt; any;
    onprogress: (ev: ProgressEvent) =&gt; any;
    ontimeout: (ev: ProgressEvent) =&gt; any;
    addEventListener(type: &quot;abort&quot;, listener: (ev: Event) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;error&quot;, listener: (ev: ErrorEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;load&quot;, listener: (ev: Event) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;loadend&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;loadstart&quot;, listener: (ev: Event) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;progress&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;timeout&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}

interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
    ...
    onreadystatechange: (ev: ProgressEvent) =&gt; any;
    ...
    addEventListener(type: &quot;abort&quot;, listener: (ev: Event) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;error&quot;, listener: (ev: ErrorEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;load&quot;, listener: (ev: Event) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;loadend&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;loadstart&quot;, listener: (ev: Event) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;progress&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;readystatechange&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: &quot;timeout&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}"><pre class="notranslate"><span class="pl-c">// lib.d.ts</span>
<span class="pl-k">interface</span> <span class="pl-smi">XMLHttpRequestEventTarget</span> <span class="pl-kos">{</span>
    <span class="pl-c1">onabort</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">onerror</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">onload</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">onloadend</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">onloadstart</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">onprogress</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">ontimeout</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"abort"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"error"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ErrorEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"load"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"loadend"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"loadstart"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"progress"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"timeout"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-smi">EventListenerOrEventListenerObject</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">interface</span> <span class="pl-smi">XMLHttpRequest</span> <span class="pl-k">extends</span> <span class="pl-smi">EventTarget</span><span class="pl-kos">,</span> <span class="pl-smi">XMLHttpRequestEventTarget</span> <span class="pl-kos">{</span>
    ...
    <span class="pl-c1">onreadystatechange</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    ...
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"abort"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"error"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ErrorEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"load"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"loadend"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"loadstart"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"progress"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"readystatechange"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"timeout"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-smi">EventListenerOrEventListenerObject</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">expected:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// lib.d.ts
interface XMLHttpRequestEventTarget {
    ...
}

interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
    ...
    onreadystatechange: (ev: ProgressEvent) =&gt; any;
    ...
    addEventListener(type: &quot;readystatechange&quot;, listener: (ev: ProgressEvent) =&gt; any, useCapture?: boolean): void;
    addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}"><pre class="notranslate"><span class="pl-c">// lib.d.ts</span>
<span class="pl-k">interface</span> <span class="pl-smi">XMLHttpRequestEventTarget</span> <span class="pl-kos">{</span>
    ...
<span class="pl-kos">}</span>

<span class="pl-k">interface</span> <span class="pl-smi">XMLHttpRequest</span> <span class="pl-k">extends</span> <span class="pl-smi">EventTarget</span><span class="pl-kos">,</span> <span class="pl-smi">XMLHttpRequestEventTarget</span> <span class="pl-kos">{</span>
    ...
    <span class="pl-c1">onreadystatechange</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">;</span>
    ...
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-s">"readystatechange"</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-kos">(</span><span class="pl-s1">ev</span>: <span class="pl-smi">ProgressEvent</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
    <span class="pl-c1">addEventListener</span><span class="pl-kos">(</span><span class="pl-s1">type</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-s1">listener</span>: <span class="pl-smi">EventListenerOrEventListenerObject</span><span class="pl-kos">,</span> <span class="pl-s1">useCapture</span>?: <span class="pl-smi">boolean</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Test {
    num: number;

    constructor(num: number) {
        this.num = num;
    }
}

var t = new Test(1);
var u = new t.constructor(2);"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Test</span> <span class="pl-kos">{</span>
    <span class="pl-c1">num</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>

    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">num</span>: <span class="pl-smi">number</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">num</span> <span class="pl-c1">=</span> <span class="pl-s1">num</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">var</span> <span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">Test</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">u</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">constructor</span><span class="pl-kos">(</span><span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">This code throws a compile error, but appears to produce valid code when entered into <a href="http://www.typescriptlang.org/Playground" rel="nofollow">http://www.typescriptlang.org/Playground</a>.</p>
<p dir="auto">EDIT:<br>
This code correctly compiles after changing the last line to:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var u = new (&lt;{ new(...args: Array&lt;any&gt;): Test }&gt;t.constructor)(2);"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">u</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-kos">(</span><span class="pl-kos">&lt;</span><span class="pl-kos">{</span> <span class="pl-k">new</span><span class="pl-kos">(</span>...<span class="pl-s1">args</span>: <span class="pl-smi">Array</span><span class="pl-kos">&lt;</span><span class="pl-smi">any</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span>: <span class="pl-smi">Test</span> <span class="pl-kos">}</span><span class="pl-kos">&gt;</span><span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">constructor</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>