Skip to content

Commit 19aac12

Browse files
author
Andy
authored
Merge pull request #10995 from Microsoft/js_doc_comment_no_tags
Handle msising tags for JsDoc nodes
2 parents af5148d + e6610c5 commit 19aac12

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ namespace ts {
16041604

16051605
// @kind(SyntaxKind.JSDocComment)
16061606
export interface JSDoc extends Node {
1607-
tags: NodeArray<JSDocTag>;
1607+
tags: NodeArray<JSDocTag> | undefined;
16081608
comment: string | undefined;
16091609
}
16101610

src/services/navigationBar.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,13 @@ namespace ts.NavigationBar {
218218
break;
219219

220220
default:
221-
if (node.jsDocComments) {
222-
for (const jsDocComment of node.jsDocComments) {
223-
for (const tag of jsDocComment.tags) {
224-
if (tag.kind === SyntaxKind.JSDocTypedefTag) {
225-
addLeafNode(tag);
226-
}
221+
forEach(node.jsDocComments, jsDocComment => {
222+
forEach(jsDocComment.tags, tag => {
223+
if (tag.kind === SyntaxKind.JSDocTypedefTag) {
224+
addLeafNode(tag);
227225
}
228-
}
229-
}
226+
});
227+
});
230228

231229
forEachChild(node, addChildrenRecursively);
232230
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
/////** Test */
4+
////export const Test = {}
5+
6+
verify.navigationBar([
7+
{
8+
"text": "\"navigationBarJsDocCommentWithNoTags\"",
9+
"kind": "module",
10+
"childItems": [
11+
{
12+
"text": "Test",
13+
"kind": "const",
14+
"kindModifiers": "export"
15+
}
16+
]
17+
}
18+
]);

0 commit comments

Comments
 (0)