<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.7.5</p>
<p dir="auto"><strong>Code</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="           var reader = new FileReader();

            reader.onload = function(evt) {
                // console.log(evt.target.result);
                debugger;
                resolve(evt.target.result);
                // resolve(evt.srcElement.result);
            };
"><pre class="notranslate">           <span class="pl-k">var</span> <span class="pl-s1">reader</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">FileReader</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

            <span class="pl-s1">reader</span><span class="pl-kos">.</span><span class="pl-en">onload</span> <span class="pl-c1">=</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">evt</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
                <span class="pl-c">// console.log(evt.target.result);</span>
                <span class="pl-k">debugger</span><span class="pl-kos">;</span>
                <span class="pl-en">resolve</span><span class="pl-kos">(</span><span class="pl-s1">evt</span><span class="pl-kos">.</span><span class="pl-c1">target</span><span class="pl-kos">.</span><span class="pl-c1">result</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
                <span class="pl-c">// resolve(evt.srcElement.result);</span>
            <span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong><br>
code should pass typescript check</p>
<p dir="auto"><strong>Actual behavior:</strong><br>
the <code class="notranslate">.result</code> fields are being marked as <code class="notranslate">does not exist on EventTarget</code> / <code class="notranslate">Element</code></p>
<p dir="auto">Trying to retrieve the result of a read file/blob via the event passed into the reader's onload/onloadend method results in a type error (Property 'result' does not exist on type 'EventTarget').</p>
<p dir="auto">This is valid JavaScript, which is failing type checking because the EventTarget interface does not have a result property.</p>
<p dir="auto">Examples:</p>
<ul dir="auto">
<li><a href="http://www.typescriptlang.org/Playground#src=var%20reader%3A%20FileReader%20%3D%20new%20FileReader%28%29%3B%0D%0A%0D%0Areader.onload%20%3D%20function%28event%3A%20ProgressEvent%29%20%7B%09%20%20%20%20%0D%0A%20%20%20%20alert%28event.target.result%29%3B%0D%0A%7D%0D%0A%0D%0Areader.readAsText%28new%20Blob%28%5B%22hello%22%2C%20%22world%22%5D%29%29%3B" rel="nofollow">Typescript playground example</a> - Clicking the run button should show an alert with the file data</li>
<li><a href="http://jsfiddle.net/sdz09aob/" rel="nofollow">Jsfiddle example</a></li>
</ul>
<p dir="auto">Workaround: Retrieve the result from the reader object (FileReader.result)</p>