Make tsc happy to allow builds to complete

This commit is contained in:
Manav Rathi 2024-04-24 15:12:32 +05:30
parent e0975130b6
commit e5545e9c80
No known key found for this signature in database
3 changed files with 28 additions and 11 deletions

View file

@ -490,7 +490,8 @@ export default function Uploader(props: Props) {
throw e;
}
await waitInQueueAndUploadFiles(
filesWithCollectionToUpload,
/* TODO(MR): ElectronFile changes */
filesWithCollectionToUpload as FileWithCollection[],
collections,
);
toUploadFiles.current = null;
@ -569,7 +570,8 @@ export default function Uploader(props: Props) {
if (isElectron()) {
if (watcher.isUploadRunning()) {
await watcher.allFileUploadsDone(
filesWithCollectionToUploadIn,
/* TODO(MR): ElectronFile changes */
filesWithCollectionToUploadIn as FileWithCollection2[],
collections,
);
} else if (watcher.isSyncPaused()) {

View file

@ -364,11 +364,17 @@ class UploadManager {
this.uiService.setUploadStage(
UPLOAD_STAGES.READING_GOOGLE_METADATA_FILES,
);
await this.parseMetadataJSONFiles(metadataJSONFiles);
/* TODO(MR): ElectronFile changes */
await this.parseMetadataJSONFiles(
metadataJSONFiles as FileWithCollection2[],
);
}
if (mediaFiles.length) {
const clusteredMediaFiles = clusterLivePhotos(mediaFiles);
/* TODO(MR): ElectronFile changes */
const clusteredMediaFiles = clusterLivePhotos(
mediaFiles as ClusterableFile[],
);
if (uploadCancelService.isUploadCancelationRequested()) {
throw Error(CustomError.UPLOAD_CANCELLED);
@ -378,7 +384,8 @@ class UploadManager {
new Map<number, string>(
clusteredMediaFiles.map((mediaFile) => [
mediaFile.localID,
assetName(mediaFile),
/* TODO(MR): ElectronFile changes */
assetName(mediaFile as FileWithCollection2),
]),
),
);
@ -387,7 +394,10 @@ class UploadManager {
mediaFiles.length !== clusteredMediaFiles.length,
);
await this.uploadMediaFiles(clusteredMediaFiles);
/* TODO(MR): ElectronFile changes */
await this.uploadMediaFiles(
clusteredMediaFiles as FileWithCollection2[],
);
}
} catch (e) {
if (e.message === CustomError.UPLOAD_CANCELLED) {
@ -721,7 +731,7 @@ type ClusterableFile = {
localID: number;
collectionID: number;
// fileOrPath: File | ElectronFile | string;
file: File | ElectronFile | string;
file?: File | ElectronFile | string;
};
type ClusteredFile = ClusterableFile & {
@ -770,8 +780,13 @@ const clusterLivePhotos = (mediaFiles: ClusterableFile[]) => {
collectionID: f.collectionID,
isLivePhoto: true,
livePhotoAssets: {
image: fFileType == FILE_TYPE.IMAGE ? f.file : g.file,
video: fFileType == FILE_TYPE.IMAGE ? g.file : f.file,
/* TODO(MR): ElectronFile changes */
image: (fFileType == FILE_TYPE.IMAGE ? f.file : g.file) as
| string
| File,
video: (fFileType == FILE_TYPE.IMAGE ? g.file : f.file) as
| string
| File,
},
});
index += 2;

View file

@ -195,7 +195,7 @@ export const uploader = async (
const { metadata, publicMagicMetadata } = await extractAssetMetadata(
worker,
parsedMetadataJSONMap,
uploadAsset,
uploadAsset2,
collection.id,
fileTypeInfo,
);
@ -229,7 +229,7 @@ export const uploader = async (
abortIfCancelled();
const file = await readAsset(fileTypeInfo, uploadAsset);
const file = await readAsset(fileTypeInfo, uploadAsset2);
if (file.hasStaticThumbnail) metadata.hasStaticThumbnail = true;