You can cast it as a HTMLInputElement:
document.getElementById("customimage").onchange = function(e: Event) {
let file = (<HTMLInputElement>e.target).files[0];
// rest of your code...
}
Update:
You can also use this:
let file = (e.target as HTMLInputElement).files[0];
More Related Contents:
- Ionic 2 – global NavBar for the app
- Ionic 2 Form goes up when keyboard shows
- Ionic – Horizontal scroll tab for Categories [duplicate]
- Page is part of the declarations of 2 modules: Error in ionic build prod
- No provider for AngularFireDatabase, AngularFireAuth
- Cannot read property of ‘xxx’ of undefined
- Use nav.push with side menu in ionic 2
- access SASS values ($colors from variables.scss) in Typescript (Angular2 ionic2)
- Angular 2 + Ionic 2: Detect if an object was modified
- Ionic2/Angular2 – Read a custom config file
- Merging http observables using forkjoin
- Call a function every 10 seconds Angular2
- Cannot read property ‘native-element’ of undefined
- How to use angular 2 service with Ionic 2?
- How do I share data between components in Angular 2?
- Error when trying to inject a service into an angular component “EXCEPTION: Can’t resolve all parameters for component”, why?
- How to use [(ngModel)] on div’s contenteditable in angular2?
- Angular4 Exception: Can’t bind to ‘ngClass’ since it isn’t a known property of ‘input’
- TS2531: Object is possibly ‘null’
- Custom ExceptionHandler change detection lag
- Trigger update of component view from service – No Provider for ChangeDetectorRef
- TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable
- Pass parameter into route guard
- Typescript dependency injection public vs private
- What is the meaning of question mark in expressions in Angular 2?
- Angular: selected on option of select doesn’t work as excepted while using along with ngModel
- What is pipe for in RxJS?
- How to throw error from RxJS map operator (angular)
- Can I use Angular i18n to translate string literals in typescript code
- How to generate components in a specific folder with Angular CLI?