Angular2 + Typescript + FileReader.onLoad = property does not exist
问题 I am using the FileReader Interface and it’s asynchronous method readAsText() to read a local text file, After that when the onload event is called, I try to read my file, my source code is something like the following: export class ReadFileComponent { text: string; readFile(): void { let reader=new FileReader(); reader.onload = function(e) { this.text=reader.result; } reader.readAsText(file); } } compilation is failed because Property "text" does not exist on type "FileReader" I think this