const [title, setTitle] = useState("");
const [summary, setSummary] = useState("");
const [content, setContent] = useState("");
// const [files, setFiles] = useState("");
const [files, setFiles] = useState<FileList | null>();
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
const data = new FormData();
data.set("title", title);
data.set("summary", summary);
data.set("content", content);
data.set('file', ~~files~~) //error on files
No overload matches this call.
Overload 1 of 3, '(name: string, value: string | Blob): void', gave the following error.
Argument of type 'FileList | null | undefined' is not assignable to parameter of type 'string | Blob'.
Type 'undefined' is not assignable to type 'string | Blob'.
Overload 2 of 3, '(name: string, value: string): void', gave the following error.
Argument of type 'FileList | null | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
Overload 3 of 3, '(name: string, blobValue: Blob, filename?: string | undefined): void', gave the following error.
Argument of type 'FileList | null | undefined' is not assignable to parameter of type 'Blob'.
Type 'undefined' is not assignable to type 'Blob'.ts(2769)