Toolbox-XToolbox-X
GuardsDOM Guards

Check FileUpload

Checks if a value is a FileUpload object.

isFileUpload

Checks if a value is a FileUpload object, commonly used in libraries like FilePond or Ant Design Upload.

Function Signature

isFileUpload(value: unknown): value is FileUpload

Type Definition

/** * Represents a file upload operation, commonly used in libraries like `FilePond` or `Ant Design Upload`. */
interface FileUpload {
 /** The primary file being uploaded. */
 file: File | CustomFile;
 /** The list of files associated with the upload. */
 fileList: CustomFile[];
}

Validation Rules

  • Must be an object
  • Must have either:
    • file property that is File or CustomFile
    • fileList property that is CustomFile[]

Example

const upload = {
  file: customFile,
  fileList: [customFile1, customFile2]
};
isFileUpload(upload); // true

Last updated: Tue, May 26, 2026 04:14:18PM (UTC)

On this page