Skip to content

Commit 7f0258b

Browse files
author
Andy
authored
getJSDocHost always returns a defined result (#24255)
1 parent d60866a commit 7f0258b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/compiler/checker.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2172,8 +2172,7 @@ namespace ts {
21722172
return;
21732173
}
21742174
const host = getJSDocHost(node);
2175-
if (host &&
2176-
isExpressionStatement(host) &&
2175+
if (isExpressionStatement(host) &&
21772176
isBinaryExpression(host.expression) &&
21782177
getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) {
21792178
const symbol = getSymbolOfNode(host.expression.left);

src/compiler/utilities.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1927,11 +1927,7 @@ namespace ts {
19271927
}
19281928

19291929
export function getJSDocHost(node: Node): HasJSDoc {
1930-
const comment = findAncestor(node.parent,
1931-
node => !(isJSDocNode(node) || node.flags & NodeFlags.JSDoc) ? "quit" : node.kind === SyntaxKind.JSDocComment);
1932-
if (comment) {
1933-
return (comment as JSDoc).parent;
1934-
}
1930+
return Debug.assertDefined(findAncestor(node.parent, isJSDoc)).parent;
19351931
}
19361932

19371933
export function getTypeParameterFromJsDoc(node: TypeParameterDeclaration & { parent: JSDocTemplateTag }): TypeParameterDeclaration | undefined {

0 commit comments

Comments
 (0)