Update the JSDoc comments for the new TypeScript version

This commit fixes the JSDoc comment for the `annotationEditorMode` setter.
The types tests fail on that now because the input value was changed from
a number to an object with various properties in recent patches, but the
JSDoc comment was not updated accordingly.

Moreover, the types tests also fail because TypeScript 5.3 assumes that
getters and setters have equal return and input value types, which is
arguably also what one would expect, but our `annotationEditorMode`
getter and setter deviate from that because the getter returns a number
while the setter accepts an object. Given that it seems more important
to document the setter entirely, including the meaning and types of its
properties, and the type of the getter can easily be inferred from this
comment and the other JSDoc comments that have `annotationEditorMode` in
it, we remove the getter type to make the types tests pass again.
This commit is contained in:
Tim van der Meij 2023-11-25 18:00:40 +01:00
parent 8aa26fad24
commit dd7ff7e662
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -2204,9 +2204,6 @@ class PDFViewer {
]);
}
/**
* @type {number}
*/
get annotationEditorMode() {
return this.#annotationEditorUIManager
? this.#annotationEditorMode
@ -2214,7 +2211,15 @@ class PDFViewer {
}
/**
* @param {number} mode - AnnotationEditor mode (None, FreeText, Ink, ...)
* @typedef {Object} AnnotationEditorModeOptions
* @property {number} mode - The editor mode (none, FreeText, ink, ...).
* @property {string|null} [editId] - ID of the existing annotation to edit.
* @property {boolean} [isFromKeyboard] - True if the mode change is due to a
* keyboard action.
*/
/**
* @param {AnnotationEditorModeOptions} options
*/
set annotationEditorMode({ mode, editId = null, isFromKeyboard = false }) {
if (!this.#annotationEditorUIManager) {