Added Type for the real useages of pdf Operations

This commit is contained in:
Saud Fatayerji
2023-11-13 03:50:02 +03:00
parent 4a832942f2
commit 77274e6117
4 changed files with 23 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ import { splitOn } from './functions/splitOn';
import { splitPDF } from './functions/splitPDF';
import { updateMetadata } from "./functions/updateMetadata";
export default {
const toExport = {
sortPagesWithPreset, rearrangePages, selectPages, removePages, removeBlankPages,
impose,
mergePDFs,
@@ -21,4 +21,12 @@ export default {
splitOn,
splitPDF,
updateMetadata,
}
}
export default toExport;
// Overide fields in the type of toExport, with the given fields and types. This seems to magically work!
// https://dev.to/vborodulin/ts-how-to-override-properties-with-type-intersection-554l
type Override<T1, T2> = Omit<T1, keyof T2> & T2;
export type OperationsUseages = Override<typeof toExport, {
impose: (snapshot: any, nup: number, format: string) => any;
}>;