在我升级到Typescript 3之前,下面的代码可以正常工作。为什么?
var file = event.target.files[0];
var reader = new FileReader();
reader.onload = () => {
this.fileForUpload.FileName = file.name;
this.fileForUpload.FileType = file.type;
var encodedString = btoa(reader.result);
console.log(encodedString);
}
reader.readAsDataURL(file);
现在它引发此错误:
Argument of type 'string | ArrayBuffer' is not assignable to parameter of type 'string'.
Type 'ArrayBuffer' is not assignable to type 'string'.
有什么解决办法?