Skip to content

Commit

Permalink
chore: Add FileRemoveReason type (#3283)
Browse files Browse the repository at this point in the history
* chore: Add `FileRemoveReason` type

* Update packages/@uppy/core/types/index.d.ts

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* fix: remove `null`

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
bencergazda and aduh95 committed Oct 31, 2021
1 parent e30601d commit 94e686d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@uppy/core/types/index.d.ts
Expand Up @@ -18,6 +18,8 @@ export type UppyFile<

export type FileProgress = UppyUtils.FileProgress;

export type FileRemoveReason = 'removed-by-user' | 'cancel-all';

// Replace the `meta` property type with one that allows omitting internal metadata addFile() will add that
type UppyFileWithoutMeta<TMeta, TBody> = OmitKey<
UppyFile<TMeta, TBody>,
Expand Down Expand Up @@ -203,7 +205,7 @@ export interface SuccessResponse {
export type GenericEventCallback = () => void;
export type FileAddedCallback<TMeta> = (file: UppyFile<TMeta>) => void;
export type FilesAddedCallback<TMeta> = (files: UppyFile<TMeta>[]) => void;
export type FileRemovedCallback<TMeta> = (file: UppyFile<TMeta>, reason: 'removed-by-user' | 'cancel-all') => void;
export type FileRemovedCallback<TMeta> = (file: UppyFile<TMeta>, reason: FileRemoveReason) => void;
export type UploadCallback = (data: { id: string, fileIDs: string[] }) => void;
export type ProgressCallback = (progress: number) => void;
export type UploadProgressCallback<TMeta> = (file: UppyFile<TMeta>, progress: FileProgress) => void;
Expand Down Expand Up @@ -318,7 +320,7 @@ export class Uppy {
file: AddFileOptions<TMeta>
): string

removeFile(fileID: string): void
removeFile(fileID: string, reason?: FileRemoveReason): void

pauseResume(fileID: string): boolean

Expand Down

0 comments on commit 94e686d

Please sign in to comment.