mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 10:58:20 -05:00
Merge pull request #11830 from Microsoft/jsDocAV
Fix the AV resulting from presence of undefined in the jsDocPropertyTags
This commit is contained in:
@@ -6639,12 +6639,16 @@ namespace ts {
|
||||
return true;
|
||||
case "prop":
|
||||
case "property":
|
||||
if (!parentTag.jsDocPropertyTags) {
|
||||
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
|
||||
}
|
||||
const propertyTag = parsePropertyTag(atToken, tagName);
|
||||
parentTag.jsDocPropertyTags.push(propertyTag);
|
||||
return true;
|
||||
if (propertyTag) {
|
||||
if (!parentTag.jsDocPropertyTags) {
|
||||
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
|
||||
}
|
||||
parentTag.jsDocPropertyTags.push(propertyTag);
|
||||
return true;
|
||||
}
|
||||
// Error parsing property tag
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
8
tests/cases/fourslash/incorrectJsDocObjectLiteralType.ts
Normal file
8
tests/cases/fourslash/incorrectJsDocObjectLiteralType.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
//// /**/
|
||||
|
||||
goTo.marker();
|
||||
verify.navigationItemsListCount(0, "foo", "exact");
|
||||
edit.insert("/**\n * @typedef {Object} foo\n * @property {any} [obj]\n */\nexport default function foo() {\n}");
|
||||
verify.navigationItemsListContains("foo", "function", "foo", "exact");
|
||||
Reference in New Issue
Block a user