Skip to content
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

Use square brackets for optional properties in the JSDoc comments of src/display/api.js #11209

Merged

Conversation

tamuratak
Copy link
Contributor

use square brackets to indicate properties are optional in JSDoc. Related to #10575. Without the square brackets, that PR would generate an incorrect d.ts file.

The diff becomes lengthy due to the restriction of maximal line length. If I can remove the word (optional), it becomes much simpler.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

Please see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits, and it would be a good idea to update the commit message to actually include JSDoc (since otherwise it's really impossible to understand what the patch does without looking at the code).

* file data. When range requests are enabled PDF.js will automatically keep
* fetching more data even if it isn't needed to display the current page.
* @property {boolean} [disableStream] - (optional) Disable streaming of PDF
* file data. By default PDF.js attempts to load PDFs in chunks.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't remove the The default value is `false`. line here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the line is not removed.

@tamuratak tamuratak force-pushed the square_bracket_for_optional branch from baba97a to b812c8c Compare October 6, 2019 10:24
@tamuratak
Copy link
Contributor Author

The commits are squashed, and the word JSDoc is included in the commit message, as requested.

@tamuratak tamuratak force-pushed the square_bracket_for_optional branch from b812c8c to d1e75ac Compare October 6, 2019 10:43
@timvandermeij timvandermeij changed the title Square bracket to indicate optional properties Use square brackets for optional properties in the JSDoc comments of src/display/api.js Oct 6, 2019
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Oct 6, 2019

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/c86997eac19cc98/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 6, 2019

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/c86997eac19cc98/output.txt

Total script time: 1.69 mins

Published

@timvandermeij
Copy link
Contributor

Here is how this renders now: http://54.67.70.0:8877/c86997eac19cc98/api/draft/global.html#DocumentInitParameters

I agree that the double optional bit is not necessary anymore, given that (optional) or other variants were used before because we didn't use the brackets, which are a better solution.

@Snuffleupagus
Copy link
Collaborator

Here is how this renders now: http://54.67.70.0:8877/c86997eac19cc98/api/draft/global.html#DocumentInitParameters

This is obviously a pre-existing issue, however:
Looking at this list, shouldn't all properties actually be marked as optional though?

@timvandermeij
Copy link
Contributor

Yes, all properties should be optional as far as I can tell. If that and #11209 (comment) are done, this patch looks good to me.

@tamuratak tamuratak force-pushed the square_bracket_for_optional branch from d1e75ac to d5ee083 Compare October 8, 2019 11:39
@tamuratak
Copy link
Contributor Author

All the properties of DocumentInitParameters are marked as optional.

intent of RenderParameters is also marked as optional.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/9c13641ada151c0/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/9c13641ada151c0/output.txt

Total script time: 1.66 mins

Published

@timvandermeij timvandermeij merged commit 5191d10 into mozilla:master Oct 8, 2019
@timvandermeij
Copy link
Contributor

Nice work; thank you for improving the documentation!

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

Successfully merging this pull request may close these issues.

4 participants