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

Fixed JSDoc comments and optional params parsing #1810

Conversation

3bl3gamer
Copy link

Closes #1804 and #567

@pkuczynski
Copy link

Any chance to get this merged anytime soon?

Copy link

@ST-DDT ST-DDT left a comment

Choose a reason for hiding this comment

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

This works very well for:

 * @param {string} [name] Some optional param.

but not for this syntax:

 * @param [name] Some optional param.

as used by tsdocs/typescript.

This is caused by consumeTypeData that erases all leading {} and [] blocks. But if it encounters both, then the cleanup of the {} does not remove the separating space and thus the [] won't be removed. If the [] is the first section, then it will get removed.

Can someone enlighten me why the [] is removed/what is it used for originally in jsdocs?

@pkuczynski
Copy link

Can someone enlighten me why the [] is removed/what is it used for originally in jsdocs?

Its to mark optional parameter: https://jsdoc.app/tags-param.html#optional-parameters-and-default-values

@ST-DDT
Copy link

ST-DDT commented Jan 30, 2022

Its to mark optional parameter: jsdoc.app/tags-param.html#optional-parameters-and-default-values

Currently these get removed completely, so any parameter name that might be in there will be lost, before it is analyzed.
Rendering it unusable. I thought there might be a different usecase where you don't need the thing inside the [].

@pkuczynski
Copy link

@Gerrit0 any plans to get this merged in any foreseeable future?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 26, 2022

I believe with 0.23, this is handled by the completely reworked comment parser, thanks for the PR though!

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

Successfully merging this pull request may close these issues.

Optional arguments are not marked as optional (JSDoc)
4 participants