Fix JSDoc types

This fixes invalid type references (either due to invalid paths for the
import or missing imports) in the JS doc, as well as some missing or
invalid parameter names for @param annotations.
This commit is contained in:
Christophe Coevoet 2023-08-31 12:01:33 +02:00
parent 92f7653cfb
commit f84f2646f4
15 changed files with 38 additions and 13 deletions

View File

@ -15,7 +15,10 @@
/** @typedef {import("./api").PDFPageProxy} PDFPageProxy */
/** @typedef {import("./display_utils").PageViewport} PageViewport */
/** @typedef {import("./interfaces").IDownloadManager} IDownloadManager */
// eslint-disable-next-line max-len
/** @typedef {import("../../web/text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
// eslint-disable-next-line max-len
/** @typedef {import("../../web/interfaces").IDownloadManager} IDownloadManager */
/** @typedef {import("../../web/interfaces").IPDFLinkService} IPDFLinkService */
import {

View File

@ -17,10 +17,10 @@
/** @typedef {import("./tools.js").AnnotationEditorUIManager} AnnotationEditorUIManager */
/** @typedef {import("../display_utils.js").PageViewport} PageViewport */
// eslint-disable-next-line max-len
/** @typedef {import("../../web/text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
/** @typedef {import("../../web/interfaces").IL10n} IL10n */
/** @typedef {import("../../../web/text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
/** @typedef {import("../../../web/interfaces").IL10n} IL10n */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/annotation_layer.js").AnnotationLayer} AnnotationLayer */
/** @typedef {import("../annotation_layer.js").AnnotationLayer} AnnotationLayer */
import { AnnotationEditorType, FeatureTest } from "../../shared/util.js";
import { AnnotationEditor } from "./editor.js";

View File

@ -146,7 +146,7 @@ class AnnotationEditor {
* @param {string} mime
* @returns {boolean}
*/
static isHandlingMimeForPasting(_mime) {
static isHandlingMimeForPasting(mime) {
return false;
}
@ -998,7 +998,7 @@ class AnnotationEditor {
* @param {boolean} isForCopying
* @param {Object} [context]
*/
serialize(_isForCopying = false, _context = null) {
serialize(isForCopying = false, context = null) {
unreachable("An editor must be serializable");
}

View File

@ -891,7 +891,7 @@ class InkEditor extends AnnotationEditor {
/**
* Convert into a Path2D.
* @param {Arra<Array<number>} bezier
* @param {Array<Array<number>>} bezier
* @returns {Path2D}
*/
static #buildPath2D(bezier) {

View File

@ -418,7 +418,7 @@ class KeyboardManager {
/**
* Execute a callback, if any, for a given keyboard event.
* The self is used as `this` in the callback.
* @param {Object} self.
* @param {Object} self
* @param {KeyboardEvent} event
* @returns
*/

View File

@ -13,6 +13,11 @@
* limitations under the License.
*/
/** @typedef {import("../interfaces").IPDFStream} IPDFStream */
/** @typedef {import("../interfaces").IPDFStreamReader} IPDFStreamReader */
// eslint-disable-next-line max-len
/** @typedef {import("../interfaces").IPDFStreamRangeReader} IPDFStreamRangeReader */
import { assert, PromiseCapability } from "../shared/util.js";
import { isPdfFile } from "./display_utils.js";

View File

@ -13,6 +13,8 @@
* limitations under the License.
*/
// eslint-disable-next-line max-len
/** @typedef {import("./annotation_storage").AnnotationStorage} AnnotationStorage */
/** @typedef {import("./display_utils").PageViewport} PageViewport */
/** @typedef {import("../../web/interfaces").IPDFLinkService} IPDFLinkService */

View File

@ -13,6 +13,8 @@
* limitations under the License.
*/
/** @typedef {import("./api").TextContent} TextContent */
class XfaText {
/**
* Walk an XFA tree and create an array of text nodes that is compatible

View File

@ -16,11 +16,13 @@
/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/annotation_storage").AnnotationStorage} AnnotationStorage */
/** @typedef {import("./interfaces").IDownloadManager} IDownloadManager */
/** @typedef {import("./interfaces").IL10n} IL10n */
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
// eslint-disable-next-line max-len
/** @typedef {import("./textaccessibility.js").TextAccessibilityManager} TextAccessibilityManager */
/** @typedef {import("./text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
import { AnnotationLayer } from "pdfjs-lib";
import { NullL10n } from "./l10n_utils.js";

View File

@ -548,7 +548,7 @@ class PDFPageView {
/**
* Update e.g. the scale and/or rotation of the page.
* @param {PDFPageViewUpdateParameters}
* @param {PDFPageViewUpdateParameters} params
*/
update({
scale = 0,

View File

@ -13,6 +13,10 @@
* limitations under the License.
*/
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/optional_content_config").OptionalContentConfig} OptionalContentConfig */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
/** @typedef {import("./event_utils").EventBus} EventBus */
/** @typedef {import("./interfaces").IL10n} IL10n */
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */

View File

@ -14,6 +14,7 @@
*/
/** @typedef {import("../src/display/api").PDFDocumentProxy} PDFDocumentProxy */
/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
/** @typedef {import("./event_utils").EventBus} EventBus */
/** @typedef {import("./interfaces").IL10n} IL10n */
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */

View File

@ -23,6 +23,10 @@
/** @typedef {import("./interfaces").IDownloadManager} IDownloadManager */
/** @typedef {import("./interfaces").IL10n} IL10n */
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
// eslint-disable-next-line max-len
/** @typedef {import("./pdf_find_controller").PDFFindController} PDFFindController */
// eslint-disable-next-line max-len
/** @typedef {import("./pdf_scripting_manager").PDFScriptingManager} PDFScriptingManager */
import {
AnnotationEditorType,

View File

@ -195,7 +195,7 @@ function watchScroll(viewAreaElement, callback) {
/**
* Helper function to parse query string (e.g. ?param1=value&param2=...).
* @param {string}
* @param {string} query
* @returns {Map}
*/
function parseQueryString(query) {
@ -461,7 +461,7 @@ function backtrackBeforeAllVisibleElements(index, views, top) {
* rendering canvas. Earlier and later refer to index in `views`, not page
* layout.)
*
* @param {GetVisibleElementsParameters}
* @param {GetVisibleElementsParameters} params
* @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`
*/
function getVisibleElements({
@ -791,7 +791,7 @@ function getActiveOrFocusedElement() {
/**
* Converts API PageLayout values to the format used by `BaseViewer`.
* @param {string} mode - The API PageLayout value.
* @param {string} layout - The API PageLayout value.
* @returns {Object}
*/
function apiPageLayoutToViewerModes(layout) {

View File

@ -15,6 +15,8 @@
/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/annotation_storage").AnnotationStorage} AnnotationStorage */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */