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.0Is it intentional that JSDoc only applies to the first VariableDeclaration? |
| return getJSDocCommentsAndTags(node); | ||
| } | ||
|
|
||
| export function getSourceOfAssignment(node: Node): Node { |
There was a problem hiding this comment.
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;
}
}
ghost
left a comment
There was a problem hiding this comment.
I need to leave a comment indicating the requested changes.
|
May be obviated by #18832. |
|
@ajaff It is intentional. Here are the reasons:
|
getParameterSymbolFromJSDocdidn't correctly track back to the source of a@paramtag 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 fromgetParameterSymbolFromJSDoctake advantage of the return value, while the bottom-up uses fromgetJSDocCommentsAndTagsjust use the truthiness. I can annotate it as such, but didn't in the initial pass.Fixes #19268