-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi!
I try to use your library and found out that the return type of useFileUpload has one mistake.
It's first element of returned array - FileUpload | [FileUpload].
This hook does not return tupple [FileUpload] when multiple is true. This hook return FileUpload[] and that's a big difference, because [FileUpload] can have only one element, not two or three, etc.
I fixed this for me in such manner:
uploadFile(
{
multiple: true,
accept: ['image/jpeg', 'image/jpg', 'image/png'],
},
(files) => {
// the fix is below
const result = (files as FileUpload[]).map((el) => ({
...el,
id: v1(),
}));
},
);But I think you can make type system for this library better. Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels