title: ERROR in src/app/app.component.ts(20,27): error TS2345: Argument of type 'string | ArrayBuffer' is not assignable to parameter of type 'string'
body: <blockquote>
    <p><strong>` ERROR in src/app/app.component.ts(20,27): error TS2345: Argument of type 'string | ArrayBuffer' is not assignable to parameter of type 'string'.
          Type 'ArrayBuffer' is not assignable to type 'string'.</strong></p>
  </blockquote>
  
  <pre><code>        import { Component } from '@angular/core';
          declare const fileSelected: any;
  
           @Component({
         selector: 'app-root',
        templateUrl: './app.component.html',
        styleUrls: ['./app.component.css']
        })
        export class AppComponent {
  
       binaryStr :any;
       inputObj :any;
        fileSelected(inputObj){
  
          var fileObj = this.inputObj.files[0];
          var webworkerReader = new FileReader();
  
          webworkerReader.onload = function(){
         var binaryStr = webworkerReader.result;
         var base64Str = btoa(binaryStr);
  
          webworkerReader.readAsBinaryString(fileObj);
         };
        }
         onclick(){
         fileSelected(this.inputObj);
  
        }
     }
  </code></pre>
  
  <p>Why am I getting this error? How to solve it?</p>