M
M
MrFlatman2018-12-12 23:34:12
typescript
MrFlatman, 2018-12-12 23:34:12

Type 'ArrayBuffer' cannot be assigned to type 'string'?

I am writing applications using angular6 and node.js, I ran into a problem, now I am writing the part that is responsible for uploading images to the server, I created a variable (yes, it is empty by default)imagePreview= ""

ERROR in src/app/categories-page/categories-form/categories-form.component.ts(74,7): error TS2322: Type 'string | ArrayBuffer' is not assignable to type 'string'.
[1]   Type 'ArrayBuffer' is not assignable to type 'string'.

Here is what I have on line 74, I don’t understand where the error is (WebStorm emphasizes reader.result)
reader.onload = () => {
      this.imagePreview = reader.result
    }

Please tell me how to fix

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question