19
rated 0 times
[
20]
[
1]
/ answers: 1 / hits: 43605
/ 6 Years ago, tue, october 23, 2018, 12:00:00
TypeScript error for reading string from FileReader
Simple code to read file contents:
const reader: FileReader = new FileReader();
reader.readAsText(file);
reader.onload = (e) => {
const csv: string = reader.result; -> getting TS error on this line
}
TypeScript error I get:
Type 'string | ArrayBuffer' is not assignable to type 'string'.
Type 'ArrayBuffer' is not assignable to type 'string'.
More From » typescript