uppy/packages/@uppy/utils/src/FileProgress.ts
Antoine du Hamel 51ecc66e64
@uppy/utils: refactor to TS (#4699)
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Nick Rutten <2504906+nickrttn@users.noreply.github.com>
Co-authored-by: Murderlon <merlijn@soverin.net>
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
2023-11-06 15:01:50 +01:00

18 lines
565 B
TypeScript

interface FileProgressBase {
progress: number
uploadComplete: boolean
percentage: number
bytesTotal: number
}
// FileProgress is either started or not started. We want to make sure TS doesn't
// let us mix the two cases, and for that effect, we have one type for each case:
export type FileProgressStarted = FileProgressBase & {
uploadStarted: number
bytesUploaded: number
}
export type FileProgressNotStarted = FileProgressBase & {
uploadStarted: null
bytesUploaded: false
}
export type FileProgress = FileProgressStarted | FileProgressNotStarted