Skip to content

Commit d54e889

Browse files
authored
Merge pull request microsoft#11830 from Microsoft/jsDocAV
Fix the AV resulting from presence of undefined in the jsDocPropertyTags
2 parents 3bdff73 + f98369b commit d54e889

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/compiler/parser.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -6639,12 +6639,16 @@ namespace ts {
66396639
return true;
66406640
case "prop":
66416641
case "property":
6642-
if (!parentTag.jsDocPropertyTags) {
6643-
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
6644-
}
66456642
const propertyTag = parsePropertyTag(atToken, tagName);
6646-
parentTag.jsDocPropertyTags.push(propertyTag);
6647-
return true;
6643+
if (propertyTag) {
6644+
if (!parentTag.jsDocPropertyTags) {
6645+
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
6646+
}
6647+
parentTag.jsDocPropertyTags.push(propertyTag);
6648+
return true;
6649+
}
6650+
// Error parsing property tag
6651+
return false;
66486652
}
66496653
return false;
66506654
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// /**/
4+
5+
goTo.marker();
6+
verify.navigationItemsListCount(0, "foo", "exact");
7+
edit.insert("/**\n * @typedef {Object} foo\n * @property {any} [obj]\n */\nexport default function foo() {\n}");
8+
verify.navigationItemsListContains("foo", "function", "foo", "exact");

0 commit comments

Comments
 (0)