-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
fix getParameterSymbolFromJSDoc #19355
Conversation
They are now used both in getJSDocCommentsAndTagsWorker and in geParameterSymbolFromJSDoc.
@mhegazy we should put this in 2.6 because it fixes a new error for 2.6. |
Please port this to release-2.6 |
It's now in release-2.6 |
@sandersn This changes how JSDoc comments apply to VariableStatements with multiple VariableDeclarations: /** @deprecated */
var a, b;
a; // deprecated
b; // not deprecated, used to be deprecated in ts@<2.6.0 Is it intentional that JSDoc only applies to the first VariableDeclaration? |
@@ -1538,6 +1538,34 @@ namespace ts { | |||
return getJSDocCommentsAndTags(node); | |||
} | |||
|
|||
export function getSourceOfAssignment(node: Node): Node { |
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.
No need to export.
Please annotate potentially undefined
return values (although as written this is potentially false
).
I would prefer multiple statements with local variables instead of writing it all as one expression that has to be formatted on different lines anyway.
if (isExpressionStatement(node)) {
const { expression } = node;
if (isBinaryExpression(expression)) {
const { operatorToken, right } = node;
return operatorToken.kind === SyntaxKind.EqualsToken ? right : undefined;
}
}
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.
I need to leave a comment indicating the requested changes.
May be obviated by #18832. |
@ajaff It is intentional. Here are the reasons:
|
getParameterSymbolFromJSDoc
didn't correctly track back to the source of a@param
tag in a lot of cases, because it didn't match the lookup code ingetJSDocCommentsAndTags
. Now both functions share the same utility functions.Note that the utility functions return
Node | undefined
, and the top-down uses fromgetParameterSymbolFromJSDoc
take advantage of the return value, while the bottom-up uses fromgetJSDocCommentsAndTags
just use the truthiness. I can annotate it as such, but didn't in the initial pass.Fixes #19268