I have the following function:- uploadPhoto() { var nativeElement: HTMLInputElement = this.fileInput.nativeElement; this.photoService.upload(this.vehicleId, nativeElement.files[0]) .subscribe(x => console.log(x)); } however on the nativeElement.files[0], I am getting a typescript error, "Object is possibly 'null'". Anyone can help me solve this issue? I tried to declare the nativeElement as a null value, however did not manage to succeed. Thanks for your help and time. Continue reading...