From fdf2c59b8f8663f30fd21ce6c4adbfa9c57d7744 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 19 Jun 2021 16:24:34 +0200 Subject: [PATCH] Add a (basic) TypeScript definitions for the viewer components (issue 13267) Please note that while the `gulp types`/`gulp typestest` tasks (obviously) still work with this patch, I've got no idea if the output is first of all even useable and secondly if it's actually useful in practice. However, in the interest of closing some (seemingly simple) issues, I suppose that this probably shouldn't hurt (and we'd need TypeScript users to help improve things here). --- external/dist/legacy/web/pdf_viewer.d.ts | 1 + external/dist/lib/README.md | 2 +- external/dist/web/pdf_viewer.d.ts | 1 + gulpfile.js | 7 +++++-- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 external/dist/legacy/web/pdf_viewer.d.ts create mode 100644 external/dist/web/pdf_viewer.d.ts diff --git a/external/dist/legacy/web/pdf_viewer.d.ts b/external/dist/legacy/web/pdf_viewer.d.ts new file mode 100644 index 000000000..6208ead24 --- /dev/null +++ b/external/dist/legacy/web/pdf_viewer.d.ts @@ -0,0 +1 @@ +export * from "pdfjs-dist/types/web/pdf_viewer.component.d.ts"; diff --git a/external/dist/lib/README.md b/external/dist/lib/README.md index 9d6a89d7f..d50ace6e1 100644 --- a/external/dist/lib/README.md +++ b/external/dist/lib/README.md @@ -3,5 +3,5 @@ pre-built library as found in e.g. the `/build`, `/web`, and `/image_decoders` folders in the root of this repository. Please note that the "lib" build target exists mostly to enable unit-testing in -Node.js/Travis, and that you'll need to handle e.g. any necessary polyfills +Node.js/GitHub, and that you'll need to handle e.g. any necessary polyfills and/or Node.js dependencies yourself if using the files in this folder. diff --git a/external/dist/web/pdf_viewer.d.ts b/external/dist/web/pdf_viewer.d.ts new file mode 100644 index 000000000..6208ead24 --- /dev/null +++ b/external/dist/web/pdf_viewer.d.ts @@ -0,0 +1 @@ +export * from "pdfjs-dist/types/web/pdf_viewer.component.d.ts"; diff --git a/gulpfile.js b/gulpfile.js index 960efba64..f7a74e703 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1382,7 +1382,10 @@ gulp.task("types", function (done) { "emitDeclarationOnly", "moduleResolution node", ].join(" --"); - exec(`"node_modules/.bin/tsc" --${args} src/pdf.js`, done); + exec( + `"node_modules/.bin/tsc" --${args} src/pdf.js web/pdf_viewer.component.js`, + done + ); }); function buildLibHelper(bundleDefines, inputStream, outputDir) { @@ -1993,7 +1996,7 @@ function packageBowerJson() { name: DIST_NAME, version: VERSION, main: "build/pdf.js", - types: "types/pdf.d.ts", + types: "types/src/pdf.d.ts", description: DIST_DESCRIPTION, keywords: DIST_KEYWORDS, homepage: DIST_HOMEPAGE,