Skip to content

[api-minor] Fix broken/missing JSDocs and typedefs, to allow updating TypeScript to the latest version (issue 14342) #14373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 18, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

This patch circumvents the issues seen when trying to update TypeScript to version 4.5, by "simply" fixing the broken/missing JSDocs and typedefs such that gulp typestest now passes.
As always, given that I don't really know anything about TypeScript, I cannot tell if this is a "correct" and/or proper way of doing things; we'll need TypeScript users to help out with testing!

Please note: I'm sorry about the size of this patch, but given how intertwined all of this unfortunately is it just didn't seem easy to split this into smaller parts.
However, one good thing about this TypeScript update is that it helped uncover a number of pre-existing bugs in our JSDocs comments.

@Snuffleupagus Snuffleupagus linked an issue Dec 14, 2021 that may be closed by this pull request
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
@Snuffleupagus Snuffleupagus force-pushed the update-TypeScript branch 2 times, most recently from 5dd9c00 to 771b33f Compare December 15, 2021 09:16
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
Comment on lines 17 to 30
/** @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("./annotation_layer_builder").AnnotationLayerBuilder} AnnotationLayerBuilder */
// eslint-disable-next-line max-len
/** @typedef {import("./pdf_rendering_queue").RenderingStates} RenderingStates */
// eslint-disable-next-line max-len
/** @typedef {import("./struct_tree_builder").StructTreeLayerBuilder} StructTreeLayerBuilder */
/** @typedef {import("./text_highlighter").TextHighlighter} TextHighlighter */
// eslint-disable-next-line max-len
/** @typedef {import("./text_layer_builder").TextLayerBuilder} TextLayerBuilder */
/** @typedef {import("./ui_utils").EventBus} EventBus */
/** @typedef {import("./xfa_layer_builder").XfaLayerBuilder} XfaLayerBuilder */

This comment was marked as outdated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @michael-yx-wu @ineiti @tamuratak Would (either of) you perhaps be able to help with testing this patch?

@Snuffleupagus Snuffleupagus force-pushed the update-TypeScript branch 2 times, most recently from eace896 to aee8dc0 Compare December 15, 2021 13:20
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
@mozilla mozilla deleted a comment from pdfjsbot Dec 15, 2021
@Snuffleupagus Snuffleupagus force-pushed the update-TypeScript branch 4 times, most recently from 632af99 to 9cbede0 Compare December 15, 2021 15:37
@Snuffleupagus Snuffleupagus changed the title Fix broken/missing JSDocs and typedefs, to allow updating TypeScript to the latest version (issue 14342) [api-minor] Fix broken/missing JSDocs and typedefs, to allow updating TypeScript to the latest version (issue 14342) Dec 15, 2021
Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good to me; while unfortunate that the upgrade failed before, it at least helped to improve the documentation/types here!

…t to the latest version (issue 14342)

This patch circumvents the issues seen when trying to update TypeScript to version `4.5`, by "simply" fixing the broken/missing JSDocs and `typedef`s such that `gulp typestest` now passes.
As always, given that I don't really know anything about TypeScript, I cannot tell if this is a "correct" and/or proper way of doing things; we'll need TypeScript users to help out with testing!

*Please note:* I'm sorry about the size of this patch, but given how intertwined all of this unfortunately is it just didn't seem easy to split this into smaller parts.
However, one good thing about this TypeScript update is that it helped uncover a number of pre-existing bugs in our JSDocs comments.
…s` file

This patch, first of all, removes circular dependencies in the TypeScript definitions. Secondly, it also moves `RenderingStates` into `web/ui_utils.js` to break another type-dependency and directly use the `XfaLayerBuilder` during XFA-printing.
Finally, note that this patch *slightly* reduces the size of the default viewer (e.g. in the `MOZCENTRAL` build) by not having to bundle code which is completely unused.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/b608bf6e9da800d/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/7a1929342b0c382/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/b608bf6e9da800d/output.txt

Total script time: 22.62 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 9
  different first/second rendering: 2

Image differences available at: http://54.241.84.105:8877/b608bf6e9da800d/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/7a1929342b0c382/output.txt

Total script time: 35.81 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 614
  different ref/snapshot: 9

Image differences available at: http://54.193.163.58:8877/7a1929342b0c382/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator Author

/botio-windows browsertest

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/608d2d0209fde61/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/608d2d0209fde61/output.txt

Total script time: 37.79 mins

  • Regression tests: FAILED
  different ref/snapshot: 7
  different first/second rendering: 1

Image differences available at: http://54.193.163.58:8877/608d2d0209fde61/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/718c8bd1d34909b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/718c8bd1d34909b/output.txt

Total script time: 4.38 mins

Published

@Snuffleupagus
Copy link
Collaborator Author

Hopefully this PR should also help reduce the number of problems whenever someone looks into issue #14017, however we (once again) need TypeScript users to help out there!

@timvandermeij timvandermeij merged commit 869b396 into mozilla:master Dec 18, 2021
@timvandermeij
Copy link
Contributor

Thank you for doing this! It's a nice improvement and it's good that the upgrade blocker is resolved now.

@Snuffleupagus Snuffleupagus deleted the update-TypeScript branch December 18, 2021 13:51
@ineiti
Copy link
Contributor

ineiti commented Dec 20, 2021

Wow - great work @Snuffleupagus ! I'm not sure I would've been able to do it in a reasonable amount of time...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix broken TypeScript upgrade to version 4.5
4 participants