filepond icon indicating copy to clipboard operation
filepond copied to clipboard

onaddfile says the error type is FilePondErrorDescription however I'm getting a different error object

Open kyle-platt opened this issue 4 years ago • 1 comments
trafficstars

Dependancies:

"react-filepond": "^7.1.1",
"filepond": "^4.28.2",
"filepond-plugin-file-validate-size": "^2.2.4",
"filepond-plugin-file-validate-type": "^1.2.6",
"filepond-plugin-image-exif-orientation": "^1.0.11",
"filepond-plugin-image-validate-size": "^1.2.6",

I'm using the onaddfile callback which claims to be the following type:

onaddfile?: (error: FilePondErrorDescription | null, file: FilePondFile) => void;

and FilePondErrorDescription is typed as:

export interface FilePondErrorDescription {
    type: string;
    code: number;
    body: string;
}

However, when I get a validation error and I console the error object I see:

{
main: "File is too large"
sub: "Maximum file size is 25 MB"
}

I would like to use the main and sub strings but I'm getting errors because they do not exist on the FilePondErrorDescription interface.

kyle-platt avatar Aug 18 '21 21:08 kyle-platt

Hm, that should indeed be similar, but types where added after those plugins so might be some inconstancy.

I'd advise to @ts-ignore this for now.

rikschennink avatar Aug 20 '21 17:08 rikschennink