uppy/packages/@uppy/utils/src/getBytesRemaining.ts
Mikael Finstad 448e667fbd
fix various type issues (#4958)
neglected in #4911:

- bytesTotal can be null (also handle that bug in runtime)
- progress is not a property on the progress object
- use `satisfies` instead of `as`
- add todo about broken `throttle` implementation
- in emitSocketProgress, progressData should not have the FileProgress type, as it is a completely different type (it comes from companion)
2024-02-28 16:55:41 +08:00

6 lines
256 B
TypeScript

import type { FileProgress } from './FileProgress'
export default function getBytesRemaining(fileProgress: FileProgress): number {
if (fileProgress.bytesTotal == null) return 0
return fileProgress.bytesTotal - (fileProgress.bytesUploaded as number)
}