-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Brackets and postfix= in @param add undefined
#22514
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4167,11 +4167,9 @@ namespace ts { | |
|
|
||
| let isOptional = false; | ||
| if (includeOptionality) { | ||
| if (isInJavaScriptFile(declaration) && isParameterDeclaration(declaration)) { | ||
| const parameterTags = getJSDocParameterTags(declaration as ParameterDeclaration); | ||
| if (parameterTags && parameterTags.length > 0 && find(parameterTags, tag => tag.isBracketed)) { | ||
| isOptional = true; | ||
| } | ||
| if (isInJavaScriptFile(declaration) && isParameter(declaration)) { | ||
| const parameterTags = getJSDocParameterTags(declaration); | ||
| isOptional = !!(parameterTags && parameterTags.length > 0 && find(parameterTags, tag => tag.isBracketed)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simpler to write
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess so. Doesn't match the next branch, so it makes the code a little less obvious to read. |
||
| } | ||
| if (!isBindingElement(declaration) && !isVariableDeclaration(declaration) && !!declaration.questionToken) { | ||
| isOptional = true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cast not valid,
isParameterDeclarationreturns true for non-parameters (maybe the name could use an improvement).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah,
isParameterisn't obvious since it's one of the few types that don't match the name of their syntax kind.