I tried to remove one of the files in FileList
, but I found that FileList
is not an Array
, and I cannot remove one of its elements through splice
:
file: {
files: FileList,
}={
files: {} as FileList
}
this.file.files.splice(index, 1);
// error message:
// Property 'splice' does not exist on type 'FileList'.
But through the for loop, you can see each file correctly:
for (let i = 0; i < this.file.files.length; i++) {
let file = this.file.files[i];
console.log(file);
}