From 95057a4e56cd04ecf4248afcc7e82a303d36c5bb Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 13 Sep 2021 13:43:16 +0200 Subject: [PATCH] Try to expose more API-functionality in the TypeScript definitions While these types apparently makes sense in TypeScript environments, we really don't want to extend the *public* API by simply exporting the relevant classes directly in `src/pdf.js` (since they should never be called/initialized manually). Please see e.g. issue 12384 where this was first requested, and note that a possible work-around was also provided there. This patch simply implements that work-around[1], which will hopefully be helpful to TypeScript users. --- [1] Based on the discussion in PR 13957, the two previous patches appear to be necessary for this to actually work. --- src/pdf.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pdf.js b/src/pdf.js index 364114c66..3a4b38e0f 100644 --- a/src/pdf.js +++ b/src/pdf.js @@ -14,6 +14,12 @@ */ /* eslint-disable sort-exports/sort-exports */ +// eslint-disable-next-line max-len +/** @typedef {import("./display/api").PDFDocumentLoadingTask} PDFDocumentLoadingTask */ +/** @typedef {import("./display/api").PDFDocumentProxy} PDFDocumentProxy */ +/** @typedef {import("./display/api").PDFPageProxy} PDFPageProxy */ +/** @typedef {import("./display/api").RenderTask} RenderTask */ + import { addLinkAttributes, getFilenameFromUrl,