mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Update
This commit is contained in:
12
task.ts
12
task.ts
@@ -24,9 +24,15 @@ export type TaskExportZipProgress = {
|
||||
total_page: number;
|
||||
};
|
||||
|
||||
export type TaskProgressType = {
|
||||
[TaskType.Download]: TaskDownloadProgess;
|
||||
[TaskType.ExportZip]: TaskExportZipProgress;
|
||||
type TaskId<T extends Record<PropertyKey, unknown>> = {
|
||||
[P in keyof T]: ({
|
||||
task_id: number;
|
||||
} & T[P]) extends infer U ? { [Q in keyof U]: U[Q] } : never;
|
||||
};
|
||||
|
||||
export type TaskProgressType = TaskId<{
|
||||
[TaskType.Download]: TaskDownloadProgess;
|
||||
[TaskType.ExportZip]: TaskExportZipProgress;
|
||||
}>;
|
||||
|
||||
export type TaskProgress = DiscriminatedUnion<"type", TaskProgressType>;
|
||||
|
||||
Reference in New Issue
Block a user