mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Support property declarations in jsdoc template generation (#36658)
* Support property declarations in jsdoc template generation * fix lint and add test
This commit is contained in:
committed by
GitHub
parent
b8b59489e1
commit
2cc585668d
@@ -251,7 +251,6 @@ namespace ts.JsDoc {
|
||||
* @param position The (character-indexed) position in the file where the check should
|
||||
* be performed.
|
||||
*/
|
||||
|
||||
export function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion | undefined {
|
||||
const tokenAtPos = getTokenAtPosition(sourceFile, position);
|
||||
const existingDocComment = findAncestor(tokenAtPos, isJSDoc);
|
||||
@@ -370,6 +369,11 @@ namespace ts.JsDoc {
|
||||
const parameters = isFunctionLike(be.right) ? be.right.parameters : emptyArray;
|
||||
return { commentOwner, parameters };
|
||||
}
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
const init = (commentOwner as PropertyDeclaration).initializer;
|
||||
if (init && (isFunctionExpression(init) || isArrowFunction(init))) {
|
||||
return { commentOwner, parameters: init.parameters };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user