New Typescript 1.8.4 build error: “ Build: Property 'result' does not exist on type 'EventTarget'. ”

前端 未结 14 1898
情书的邮戳
情书的邮戳 2020-12-23 14:48

I am New to typescript. In my Durandal application I migrated to VS-2012 to VS-2015 means typescript 0.9 to typescript 1.8.4. After migrated I got so many build errors. I re

14条回答
  •  粉色の甜心
    2020-12-23 15:12

    If anyone is finding the simplest solution then this worked for me.

    var reader:any,
    target:EventTarget;
    reader= new FileReader();
    reader.onload = function (imgsrc){
    //var fileUrl = imgsrc.target.result; //change to
    var fileUrl = (imgsrc.target as FileReader).result; //cast to correct type
    }
    

提交回复
热议问题